I have converted 0_7.xlsx to Images but date format in the images is not same to original file’s one.
Do you have a function to set date format in rendering?
This is my code.
This is my code
----
private PageListResult ConvertExcelToImage()
{
try
{
var pageResultList = new List();
// Instantiate the License class
Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(“Aspose.Total.lic”);
var pageImgDir = CreateTempDirectory();
// Convert .xls and .xlsx file to PDF.
Workbook book = new Workbook(this._stream);
//Define ImageOrPrintOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions()
{
ImageFormat = ImageFormat.Png, //Specify the image format
VerticalResolution = this.config.ImageReadDpi,
HorizontalResolution = this.config.ImageReadDpi
};
int totalPageCount = 0;
foreach (Worksheet sheet in book.Worksheets)
{
//Render the sheet with respect to specified image/print options
SheetRender sr = new SheetRender(sheet, imgOptions);
for (int i = 0; i
{
totalPageCount++;
if (totalPageCount > this.config.DocumentMaxPageNumber)
break;
using (Bitmap bitmap = sr.ToImage(i))
{
var imgPath = ExportImageFile(pageImgDir, totalPageCount, bitmap);
var thumbPath = ExportThumbnailFile(imgPath, totalPageCount, bitmap);
var pageResult = new PageResult(totalPageCount, imgPath, thumbPath);
pageResultList.Add(pageResult);
}
}
if (totalPageCount >= this.config.DocumentMaxPageNumber) break;
}
return new PageListResult(pageResultList, this.config.DocumentMaxPageNumber < totalPageCount);
}
catch (Exception ex)
{
throw new Exception(“Failure converting excel”, ex);
}
}
----
Thank you,
PFU DSOL2
Hi,
Hello team,
Thank you for your support.
Your screenshot is same as my environment’s one. I can see 30-1-2012 in the converted image but actuall data is 30-Jan-2012. I think 30-Jan-2012 shoud be rendered.
Please find attached files which are screenshot and a converted page.
Thank you,
PFU DSOL2
Hi,
Hello team,
Thank you for your support.
I have attached pdf files with Aspose.Cells 17.5 on my computer.
C#
------------------------------------------------
Workbook wb = new Workbook(“0_7.xlsx”);
wb.Settings.LanguageCode = CountryCode.Canada;
wb.Settings.Region = CountryCode.Canada;
------------------------------------------------
->07_Canada.pdf (It shows 30-Jan-2012)
C#
------------------------------------------------
Workbook wb = new Workbook(“0_7.xlsx”);
wb.Settings.LanguageCode = CountryCode.Default;
wb.Settings.Region = CountryCode.Default;
------------------------------------------------
->07_Default.pdf (It shows 30-1-2012)
C#
------------------------------------------------
Workbook wb = new Workbook(“0_7.xlsx”);
wb.Settings.LanguageCode = CountryCode.Japan;
wb.Settings.Region = CountryCode.Japan;
------------------------------------------------
->07_Default.pdf (It shows 30-1-2012)
I identified date format is affected by LanguageCode and Region settings as you have said. However, In my opinon, date format should be affected by “Format Cells” of Excel first.
MS Excel outputs the following pdf by SaveAs on my computer. I hope Aspose.Cells API behaves as with MS Excel SaveAs operation.
->07_SaveAsByExcel.pdf (It shows 30-Jan-2012)
Thank you,
PFU DSOL2
Hi,
- CELLSNET-45410 - Issue in Date format setting in Rendering
Hi,
Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture);
Hello team,
Thank you for your support.
Console.WriteLine outputs "ja_JP"on my computer. My OS and Office settings is all “Japan”.
It seems that date format “dd-mmmm-yyyy” is not affected by region settings of OS and Office when Excel outputs pdf.
In case of [%-411], Excel outputs pdf with 30-1-2012 on my computer. however I can not use this workaround because my customer own the excel files.
Let me know if you need anything, I will do test on my computer.
Thank you,
PFU DSOL2
Hi,