Accept Granted
Using for CODING:
-
It is an minimal code to set-up and written the formulas into the clone excel file.
-
Maybe, it’s too short to show on your mind. Please trying to read it.
/---------------------------------------------------------------------------------------------------------------------------------/
__…
for ( Integer column : colums )
{
String columnName = ExcelUtils.convertColNumberToColName( column );
String formula = "SUM(" + columnName + (currentGroupRow + 1) + ":" + columnName
+ (currentGroupRow + memberOfOrganisationUnitGroups.size()) + ")";
ExcelUtils.writeFormula( currentGroupRow, column, formula, sheet, number );
}
for ( OrganisationUnit orgUnit : memberOfOrganisationUnitGroups )
{
i++;
ExcelUtils.writeValue( serialRow + i, serialCol, String.valueOf( serial ), ExcelUtils.NUMBER,
sheet, number );
ExcelUtils.writeValue( groupRow + i, groupCol, orgUnit.getName(), ExcelUtils.TEXT, sheet,
textLeft );
/*
tx_bieu_2.xls (34 KB)
···
*
*/
for ( ReportItem reportItem : ((ReportExcelGroupListing) reportExcel).getReportItems() )
{
if ( !reportItem.getItemType().equalsIgnoreCase( ReportItem.TYPE.SERIAL )
&& !reportItem.getItemType().equalsIgnoreCase( ReportItem.TYPE.ORGANISATION ) )
{
if ( reportItem.getItemType().equalsIgnoreCase( ReportItem.TYPE.FORMULA_EXCEL ) )
{
String formula = reportItem.getExpression();
formula = formula.replace( "*", (groupRow + i) + "" ).toUpperCase();
ExcelUtils.writeFormula( groupRow + i, reportItem.getColumn(), String
.valueOf( formula ), sheet, number );
}
else if ( reportItem.getItemType().equalsIgnoreCase( ReportItem.TYPE.DATAELEMENT ) )
{
ExcelUtils.writeValue( groupRow + i, reportItem.getColumn(), String
.valueOf( getDataValue( reportItem, orgUnit ) ), ExcelUtils.NUMBER, sheet,
number );
}
else if ( reportItem.getItemType().equalsIgnoreCase( ReportItem.TYPE.INDICATOR ) )
{
ExcelUtils.writeValue( groupRow + i, reportItem.getColumn(), String
.valueOf( getIndicatorValue( reportItem, orgUnit ) ), ExcelUtils.NUMBER, sheet,
number );
}
}
}
serial++;
}
__ …
/---------------------------------------------------------------------------------------------------------------------------------/
USING for HANDS:
- I’ve attached an excel file example for illustrating.
- You should have copied and searched “TỔNG SỐ” to find out the formula cells.
Thanks !
On Wed, Jun 17, 2009 at 4:21 PM, Murodullo Latifov murodlatifov@yahoo.com wrote:
Hi,
Can you post minimal related files (java code, excel template, call to database or so) so we could look at?
regards,
murod
–
Hieu.HISPVietnam
Good Health !