Hi,
In excel, the format hh:mm:ss is already set, but when I render the data using aspose APIs, this format doesn’t get applied to the data. I still get the data in its original format which is hh:mm:ss.000. When I edit that data manually in excel, then that format gets applied. Where is the problem? Is there any way to trigger it?
Hi Neha,
Hi,
I am never converting excel sheet to PDF. The problem comes in excel only. Let me again explain -
I am programmatically setting the format pattern with this line in my spreadsheet for some specific columns
Style style = col.getStyle();
style.setCustom(“hh:mm:ss”);
col.applyStyle(style, flag);
Then I am rendering the data (which is in hh:mm:ss.000 format) into these columns using
designer.setDataSource(col_name, dataArray);
But, the above format(hh:mm:ss) does not get applied to these columns.
Is there any way we can trigger this after rendering the data, because I can see in excel that the format hh:mm:ss is set for those columns.
Thanks,
Neha
Hi Neha,
WorkbookDesigner report = new WorkbookDesigner();
Worksheet w = report.getWorkbook().getWorksheets().get(0);
w.getCells().get(“A1”).putValue("&=$VariableArray");
Style style = w.getCells().getColumns().get(0).getStyle();
style.setCustom(“hh:mm:ss”);
StyleFlag flag = new StyleFlag();
flag.setNumberFormat(true);
w.getCells().getColumns().get(0).applyStyle(style, flag);
report.setDataSource(“VariableArray”, new String[] { “11:12:00”, “11:59:00”, “1:12:00”, “1:1:22”, “00:00:00” });
report.process(false);
report.getWorkbook().save(dir + “output.xlsx”);
Hi,
Can you try with this datasource -
report.setDataSource(“VariableArray”, new String[] { “11:12:00.800”, “11:59:00.342”, “1:12:00.100”, “1:1:22.600”, “00:00:00.200” });
And tell me if milliseconds does not appear in excel? I want to make sure that it works before upgrading to the newest version.
Thanks,
Neha
Hi,
WorkbookDesigner report = new WorkbookDesigner();
Worksheet w = report.getWorkbook().getWorksheets().get(0);
w.getCells().get(“A1”).putValue("&=$VariableArray(numeric)");
Style style = w.getCells().getColumns().get(0).getStyle();
style.setCustom(“hh:mm:ss”);
StyleFlag flag = new StyleFlag();
flag.setNumberFormat(true);
w.getCells().getColumns().get(0).applyStyle(style, flag);
report.setDataSource(“VariableArray”, new String[] { “11:12:00.800”, “11:59:00.342”, “1:12:00.100”, “1:1:22.600”, “00:00:00.200” });
report.process(false);
report.getWorkbook().save(“out1.xlsx”);
Hi,
It doesn’t work for me. Is there any other solution?
Thanks,
Neha Singh
Hi Neha,