We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Date format issue

Hi team,

we are using aspose cells 2.5.4.17.jar for excel generator.

i am trying to apply the date format on column using style and styleflag.

but the values are not converted to the required date.

please find the attached code and csv file.

code:
-----

import com.aspose.cells.;
import java.util.
;
public class pivottest1
{
public pivottest1()
{
}

public static void main(String[] args)
{
try{
Workbook workbook = new Workbook();
workbook.open(“D:\Aspose Files\1008253_693_1.csv”,FileFormatType.CSV);
Style style = workbook.createStyle();
style.setCustom(“dd-mmm-yy”);
StyleFlag styleFlag = new StyleFlag();
styleFlag.setAll(true);
workbook.getWorksheets().getSheet(0).getCells().getColumns().getColumn(4).applyStyle(style,styleFlag);
workbook.save(“D:\Aspose Files\693.xlsx”,FileFormatType.XLSX);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

Thanks & regards.

Ranjith.

Hi,


I have tested your issue with latest Java version/fix v7.0.3.2, it works fine. Please use latest version as we cannot check or evaluate issues in older versions. If you still find the issue with v7.0.3, we will figure it out soon.

Sample code (your code is updated accordingly for latest changed APIs set of the version):

Style style = workbook.createStyle();
style.setCustom(“dd-mmm-yy”);
StyleFlag styleFlag = new StyleFlag();
styleFlag.setAll(true);
workbook.getWorksheets().get(0).getCells().getColumns().get(4).applyStyle(style,styleFlag);
workbook.save(“693.xlsx”,SaveFormat.XLSX);


I have also attached the output XLSX file for your reference.

Thank you.