Hi,
One of my column in the XLS in right justified. When I tried to convert the XLS to PDF, the style information for the right justified column did not get carried over to the PDF - it's always left justified Can you please help?
Below is my code:
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
sheet.Name = "Expenses";
//Obtain the cells of the first worksheet.
Aspose.Cells.Cells cells = workbook.Worksheets[0].Cells;
Column columnCurrency = cells.Columns[1];
Aspose.Cells.Style style;
StyleFlag flag;
style = workbook.Styles[workbook.Styles.Add()];
style.Number = 7;
style.HorizontalAlignment = TextAlignmentType.Right;
flag = new StyleFlag();
flag.NumberFormat = true;
columnCurrency.ApplyStyle(style, flag);
sheet.Cells.ImportDataTable(dtData, false, "A8");
sheet.AutoFitColumns();
_SaveAsFileName = SaveAsFileName + ".pdf";
string filePathXLS = Server.MapPath("~/tempdata/xlsToPDF.xls");
string filePathXML = Server.MapPath("~/tempdata/xlsToPDF.xml");
// Saving an XLS file in Aspose.Pdf xml format
workbook.Save(filePathXLS);
workbook.Open(filePathXLS);
workbook.Worksheets[0].PageSetup.FitToPagesWide = 1;
workbook.Save(filePathXML, FileFormatType.AsposePdf);
// Converting XLS file to PDF through Aspose.Pdf using Aspose.Pdf xml file as a medium
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(filePathXML, null);
pdf.IsLandscape = true;
pdf.Save(_SaveAsFileName, Aspose.Pdf.SaveType.OpenInAcrobat, this.Response);