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

Free Support Forum - aspose.com

Custom Date Format Problem While Rendering to PDF


Sorry to bother again, but here is another problem I have met.
I got same date value (2015/10/19) in different formats, one shows “2015年10月19日 星期一” in excel while another shows “2015年10月19日”. But in aspose, after using cell.getStyle.getCustom(), both results are same, show
dddd,\ mmmm\ dd,\ yyyy
After converting this file to pdf, It show “2015年10月19日” only without “星期一”.
So how can I get the correct result which has “星期一”. Attachment is original file.

And another question is how can I get the width of a wrapped text without using getColumnWidthPixel()? the getWidthOfValue() method returns a too large value.

Looking forward to your response, and thank you again!

Hi Lou,

First of all, please note that we have split the existing thread to create a new one on your behalf in order to keep the tracking easy. Moreover, it is advised to create a new thread for each distinct problem.

Regarding your concerns, I have checked your provided spreadsheet in Excel 2013 and the date is displayed as 2015年10月19日which is rendered to PDF as well, therefore we are not able to find any problem yet. Could you please share a snapshot of the spreadsheet showing the date in your desired format along with application used to load the spreadsheet?

Regarding the other part of your inquiry, please share the sample spreadsheet that gives you a large value for the getWidthOfvalue method so we could investigate if the returned value is correct or not.

Hi again,

This is to update you that we have performed a few testes in reference to the getWidthOfvalue method. Please note, the aforementioned method seems to return the value (in pixels) according to the total size of the text in the cell while ignoring the wrapping effect. Please check the following piece of code that assesses the width of the text in the wrapped cell and modifies the column width accordingly. Please note, in this case the cell will have some extra space at the far end of the cell. You can avoid this by using the Worksheet.autoFitColumn(int columnIndex) method to increase the width of the column according to the largest line of the text in the wrapped cell.


Workbook wb;
try {
wb = new Workbook(“D:/book1.xlsx”);
Cells cells = wb.getWorksheets().get(0).getCells();
int widthOfValue = cells.get(“A1”).getWidthOfValue();
int columnIndex = cells.get(“A1”).getColumn();
Column column = cells.getColumns().get(columnIndex);
cells.setColumnWidthPixel(columnIndex, widthOfValue);
} catch (Exception e) {