=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java 2010-10-29 12:19:15 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java 2010-12-16 08:48:12 +0000 @@ -132,7 +132,7 @@ protected PeriodService periodService; - protected PeriodGenericManager periodGenericManager; + protected PeriodGenericManager periodGenericManager; protected ReportExcelService reportService; @@ -391,8 +391,8 @@ } protected void installPeriod( Period period ) - { - + { + Calendar calendar = Calendar.getInstance(); // Monthly period @@ -463,12 +463,17 @@ this.initFormulaEvaluating(); - ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(), - organisationUnit.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); - - ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format - .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); - + if ( reportExcel.getOrganisationRow() != null && reportExcel.getOrganisationColumn() != null ) + { + ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(), + organisationUnit.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); + } + + if ( reportExcel.getPeriodRow() != null && reportExcel.getPeriodColumn() != null ) + { + ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format + .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); + } } protected double getIndicatorValue( ReportExcelItem reportItem, OrganisationUnit organisationUnit ) @@ -705,7 +710,7 @@ { Double aggregatedValue = aggregationService.getAggregatedDataValue( dataElement, optionCombo, startDate, endDate, organisationUnit ); - + if ( aggregatedValue == null ) { aggregatedValue = 0.0; @@ -735,12 +740,17 @@ this.initFormulaEvaluating(); - ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(), - organisationUnitGroup.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); - - ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format - .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); - + if ( reportExcel.getOrganisationRow() != null && reportExcel.getOrganisationColumn() != null ) + { + ExcelUtils.writeValueByPOI( reportExcel.getOrganisationRow(), reportExcel.getOrganisationColumn(), + organisationUnitGroup.getName(), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); + } + + if ( reportExcel.getPeriodRow() != null && reportExcel.getPeriodColumn() != null ) + { + ExcelUtils.writeValueByPOI( reportExcel.getPeriodRow(), reportExcel.getPeriodColumn(), format + .formatPeriod( period ), ExcelUtils.TEXT, templateWorkbook.getSheetAt( 0 ), csText ); + } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~