Free Support Forum - aspose.com

Aspose.Cell issue while converting excel to pdf for currency type cells

Hi,


I am using aspose.cell for converting excel to pdf. For USD currency format cells it is not working correctly

In excel the amount is like:
USD 19.00
But when we convert it into pdf by aspose.cell the amount will be showing as:
USd 19.00
It is changing d into lower case

Thanks,
Vishwajeet



Hi Vishwajeet,


Thank you for considering Aspose APIs, and welcome to Aspose.Cells support forum.

In order to investigate the said issue, please share the input spreadsheet, its generated PDF file along with your environment details as follow.

  • Operating system version & architecture
  • Platform (.NET/Java/Android)
  • Target .NET Framework version (in case you are using .NET APIs) or JDK version (if you are using Java or Android API)
  • Aspose.Cells API version
  • Locale of the machine where conversion is taking place
  • Executable code snippet to reproduce the issue

Looking forward to your response.

Hi,


Thanks for the quick reply please find the required details below:


  • Operating system version & architecture -------------- Windows Server 2012 R2
  • Platform (.NET/Java/Android) ------------- .Net
  • Target .NET Framework version (in case you are using .NET APIs) or JDK version (if you are using Java or Android API)--------- 4.5
  • Aspose.Cells API version ------------ 5.1.2.0 ( 2.2)
  • Locale of the machine where conversion is taking place ----- English (United States)
  • Executable code snippet to reproduce the issue

// Convert the file to a PDF
var workbook = new Workbook(“ExcelFile.xlsx”);
workbook.Worksheets[0].AutoFitRows();
workbook.Worksheets[0].PageSetup.LeftMargin = 1;
workbook.Worksheets[0].PageSetup.RightMargin = 1;
workbook.Worksheets[0].PageSetup.TopMargin = 1;
workbook.Worksheets[0].PageSetup.BottomMargin = 1;


var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.Compliance = Aspose.Cells.Rendering.PdfCompliance.None;
workbook.Save(“pdfFile-temp.pdf”, pdfSaveOptions);


using (Stream inputPdfStream = new FileStream(“pdfFile-temp.pdf”, FileMode.Open, FileAccess.Read, FileShare.Read))
using (Stream outputPdfStream = new FileStream(“pdfFile.pdf”, FileMode.Create, FileAccess.Write, FileShare.None))
{
var reader = new PdfReader(inputPdfStream);
var stamper = new PdfStamper(reader, outputPdfStream);
var pdfContentByte = stamper.GetOverContent(1);
stamper.Close();
}
File.Delete(“pdfFile-temp.pdf”);

Hi again,


Thank you for the samples and code.

You are using a quite older release of Aspose.Cells for .NET which may have a bug for this scenario. I have tested the case using the latest version of Aspose.Cells for .NET 16.11.2 (attached) and I am not able to notice the said issue. Please give a try to the latest revision of the API on your side as well.

Please note, I have evaluated the case from Aspose.Cells’ perspective only.

C#

var workbook = new Workbook(dir + “ExcelFile.xlsx”);
workbook.Worksheets[0].AutoFitRows();
workbook.Worksheets[0].PageSetup.LeftMargin = 1;
workbook.Worksheets[0].PageSetup.RightMargin = 1;
workbook.Worksheets[0].PageSetup.TopMargin = 1;
workbook.Worksheets[0].PageSetup.BottomMargin = 1;
var pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.Compliance = Aspose.Cells.Rendering.PdfCompliance.None;
workbook.Save(dir + “pdfFile-temp.pdf”, pdfSaveOptions);