Converting XLS file to XLSX discard text formatting (vertical and horizontal align and wordwrap)

When I open an XLS file using Aspose.Cells, and save it as an XLSX file, the cell’s text fomatting is discarded - in particular the vertical and horizontal text align, as well as the word-wrap setting.


For example, in the attached zip file you can see that the source XLS file has text blocks where text is horizontally and vertically centered and have word-wrapping set on - in particular, the block containing the text, “All data is UNWEIGHTED…” (cell C26)

In the output XLSX file, the cell has none of the text formatting.

The XLS file was generated in SSRS 2008 R2 using the built-in “Export as Excel” toolbar option.

I am using Aspose.Cells 7.1.2.0 and Excel 2007.

My source code is as follows:

private void ConvertFiles(List fileList)
{
Workbook starterWorkbook = null;

fileList.ForEach(f =>
{
if (starterWorkbook == null)
{
starterWorkbook = new Workbook(f);
}
else
{
starterWorkbook.Combine(new Workbook(f));
}
});

starterWorkbook.Save(fileList[0] + “x”, SaveFormat.Xlsx);
Process.Start(new ProcessStartInfo(fileList[0] + “x”));
}

There are also issues with fonts losing or changing color.

Hi,

I can notice the issue in the saved XLSX file which has formatting issues as you mentioned.
I use the simplest code to reproduce the issue.
Sample code:

string filePath = @"E:\test2\Landing.xls";
Workbook workbook = new Workbook(filePath);
workbook.Save(filePath + ".out.xlsx", SaveFormat.Xlsx);

I have logged a ticket with an id: `CELLSNET-40482`. We will look into your issue soon.

Thank you.

Hi,


We have fixed this issue. Please download: Aspose.Cells for .NET (Latest Version)

Thanks for such a prompt reply.


Most of the cell formatting issues that I identified have been fixed. However, there still seems to be an issue with cells losing their foreground color property. I am attaching another version of the spreadsheet generated using the same source code as listed above. If you examine the second tab on the spreadsheet named “Results.xlsx”, you’ll see that the cells in the top row have no visible foreground color set.

Hi,

Thanks for your posting.

Please use Add/Update button to attach your file.

You need to click on the Reply button and not Quick Reply button.

Please see the screenshot for your help.

Edit: Its good to know you have figured it out.

Screenshot

Hi,

I have tested your files with the latest version:
Aspose.Cells for .NET (Latest Version) and could not replicate the problem.

Please take a look and if you could see problems, then please provide me screenshots, highlight the problems with red circles. You can create screenshots in Ms-Paint.

Please see the one, I have created in the above post.

Below is my code for a reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\proj”;

string[] paths = Directory.GetFiles(filePath);

foreach (string path in paths)
{
Workbook workbook = new Workbook(path);

workbook.Save(path + “.out.xlsx”);
}


Thanks for the explanation regarding “reply” versus “quick reply”.


You may notice that my code is different from yours because I am using Workbook.Conbine:

fileList.ForEach(f =>
{
if (starterWorkbook == null)
{
starterWorkbook = new Workbook(f);
}
else
{
starterWorkbook.Combine(new Workbook(f));
}
});

I am attaching a zip file with a screen print showing the font color discrepancies. The source XLS file (Survey Summary.xls) shows white text on blue at the top of the spreadsheet. The output file (Results.xlsx), which was generated using the code snippet above, shows the text as blue on blue.

The text is in the spreadsheet cell; however, the font color of white is not set…

Thanks again!

Hi,

Sorry, I am not able to run your C# lambda expression, can you please provide me a runnable code.

I think, if you will use the latest version:
Aspose.Cells for .NET (Latest Version) , then it will fix your problems, because I have compared your screenshot with the output xlsx file and it is fine.

Hi,

We were able to reproduce this issue using the latest version: Aspose.Cells for .NET v7.1.2.2 with the following code.

We have logged this issue in our database. Development team will look into this issue and once the fix is available or we have some update, we will let you know asap.

This issue has been logged as CELLSNET-40499.

C#


string file = @“D:\Survey Summary.xls”;

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(@“D:\landing.xls”);

workbook.Combine(new Aspose.Cells.Workbook(file));

workbook.Save(@“D:\dest.xlsx”);

Hi,

We have fixed this issue. Please download: Aspose.Cells for .NET (Latest Version)

The issues you have found earlier (filed as CELLSNET-40482) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.