This is a very strange issue I am seeing. I have 2 cells with numbers and 2 text boxes, each text box referencing one of the cells values. I want to center align both text boxes and export to PDF. If the cell has a single digit number (1-9), the referenced text box only displays it left aligned. However, if the cell has a multi-digit number (10+), the referenced text box correctly displays it center aligned. Even if I just save the file to a new spreadsheet, rather than exporting to PDF, the resulting spreadsheet isn’t right either.
I used the attached file and code below.
Workbook wb = new Workbook(@“c:\temp\AlignmentTest.xlsx”);
Worksheet ws = wb.Worksheets[0];
ws.Cells[“A1”].PutValue(9);
ws.Cells[“A2”].PutValue(12);
wb.CalculateFormula();
ws.Shapes.UpdateSelectedValue();
PdfSaveOptions opts = new PdfSaveOptions();
opts.OnePagePerSheet = true;
wb.Save(@“c:\temp\AlignmentTest.pdf”, opts);
wb.Save(@“c:\temp\AlignmentTest2.xlsx”);
Hi,
Thanks for your posting and using Aspose.Cells.
We have tested your issue with the following sample code which is same as yours using the latest version: Aspose.Cells for .NET v8.9.0.9 with your sample excel file and were able to observe this issue and found that alignment is not working inside a textbox.
We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as
- CELLSNET-44655 - Alignment is not working inside a textbox
I have also attached the output excel and pdf files generated with this code for a reference.
C#
Workbook wb = new Workbook(@“AlignmentTest.xlsx”);
Worksheet ws = wb.Worksheets[0];
ws.Cells[“A1”].PutValue(9);
ws.Cells[“A2”].PutValue(12);
wb.CalculateFormula();
ws.Shapes.UpdateSelectedValue();
PdfSaveOptions opts = new PdfSaveOptions();
opts.OnePagePerSheet = true;
wb.Save(@“AlignmentTest.pdf”, opts);
wb.Save(@“AlignmentTest2.xlsx”);
Hi again,
This is to update you that we have resolved the problem logged earlier as CELLSNET-44655. We will shortly share the fix here for your testing.
The issues you have found earlier (filed as CELLSNET-44655) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.