Unable read xlsx file

Hi,

Thank you for considering Aspose.

To further inform you, the chart color issue in generated xls (Excel 2003) file is because chart in your template xlsx file contain colors which are not in excel 2003 palette, so these colors will get lost if you save the file to xls format.

Also, currently reading gradient fill data from xlsx chart is not supported, so gradient fill data of the chart will get lost in the generated xls file.

Thank You & Best Regards,

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


This message was posted using Notification2Forum from Downloads module by Amjad Sahi.

Hi,

When we convert xlsx to xls the chart's colors are missing even though the colors are same as the 2003 palatte.

regards,

janakiraman

Hi,

Thank you for considering Aspose.

Well, I tested your scenario and found no problem when saving an XLSX file to XLS file. The standard palette colors in the charts are saved fine. Please post your template file here which causes this problem and we will look into it soon.

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

Also, if you use the gradient fill with standard palette colors in your XLSX file and save it as XLS file, the colors will get lost. If you use solid fill, the colors will remain same in the generated XLS file.

Thank You & Best Regards,

Hi,

Well, since the series color info is contained in the gradient fill data from xlsx file’s chart, so, the color would get lost saving to xls format. This is not supported yet. But, if a series uses solid fill and colors in the excel 2003 color palette, the colors won’t get lost saving to xls format.

Thank you.

Hi ,

I have attached sample file for your reference.

In the output file orange color is missing which is the standard palette color.

Regards

Janakiraman

Hi,

Thank you for sharing your template file.

We have found your mentioned issue after an initial test. We will fix it soon.

Thank You & Best Regards,

Hi,

Any updates on issue Id : 175105

Regards

Janakiraman

Hi,

I have attached the latest template , which we tried to convert 2007(xlsx) to 2003(xls).

When we tried to convert this ,we are facing color missing issue in the chart.

Regards

Janakiraman

Hi,

Thank you for sharing your template file.

We have found the issue regarding chart series colors in the generated XLS file. We are working on this issue and we will provide you a fix as soon as the issue gets resolved.

Thank you for being patient,

Hi Aslam,

Any updates on this issue.

Regards

Janakiraman

Hi,

Thank you for considering Aspose.

We are working on your issue and hopefully, we will provide you with a fix in 2~3 days time.

Thank you for understanding,

Hi,

Thank you for considering Aspose.

After checking the file 21010.xlsx again, we find the color of the area is not in the standard Palette. Please use Workbook.IsColorInPalette to check it. If you save the xlsx file to xls file, you will find the color of the area is changed.

Please check it with the following codes:

Workbook workbook = new Workbook();

workbook.Open(@"f:\filetemp\21010.xlsx");

Chart chart = workbook.Worksheets[0].Charts[0];

for (int i = 0; i < chart.NSeries.Count; i++)

{

Console.WriteLine(chart.NSeries[i].Type);

Console.WriteLine(workbook.IsColorInPalette(chart.NSeries[i].Area.ForegroundColor));

Console.WriteLine(chart.NSeries[i].Area.ForegroundColor);

}

We will try to look for a similar color in the palette to replace the color of the area, but this feature cannot be supported soon.

As a workaround, please set the color to the palette manually by using the following code,

Workbook workbook = new Workbook();

workbook.Open(@"f:\filetemp\21010.xlsx");

Chart chart = workbook.Worksheets[0].Charts[0];

for (int i = 0; i < chart.NSeries.Count; i++)

{

System.Drawing.Color color = chart.NSeries[i].Area.ForegroundColor;

if (!workbook.IsColorInPalette(color))

{

workbook.ChangePalette(color, 55 - i);

}

}

workbook.Save(@"f:\filetemp\dest.xls");

Thank You & Best Regards,

Hi,

Please try the attached version. We will save a similar foreground color of the chart area in this fix.

Thank you.

hi,

When we convert XLSX (2007) to Xls (2003) the background color of the cell is missing.

Is there any workaround for this issue.

Regards

Janakiraman

Hi,

Well, MS Excel 2007 Xlsx color palette has more colors and is more enhanced. MS Excel 2003 xls standard color palette has limited colors. So, it is quite possible that when you convert/save as MS Excel 2007 xlsx file to MS Excel 2003 xls format, the colors might be lost/changed. There are some style formattings/colors for xlsx files which might not work/look the same in xls file format. Could you check the conversion xlsx->xls in MS Excel 2007 manually if it works fine.

If you confirm it works, kindly post your template xlsx and output xls file(generated by Aspose.Cells) with sample code, we will check your issue soon.

Thank you.

Hi,

Thank you for considering Aspose.

Well, it seems that colors in your XLSX files are not in the default Excel 2003 color template. So you have to use Workbook.IsColorInPalette option to check the color in the default palette and then you can add the color in the default palette. Please see the following code for your reference,
Sample Code:

//Instantiate a new Workbook.

Workbook excelbook = new Workbook();

excelbook.Open("c:\\output.xlsx",FileFormatType.Excel2007Xlsx);

Worksheet sheet = excelbook.Worksheets[0];

int colorIndex = 55;

for (int row = 0; row <= sheet.Cells.MaxRow;row++ )

{

for (int column = 0; column <= sheet.Cells.MaxColumn; column++)

{

Cell cell = sheet.Cells[row,column];

if (!excelbook.IsColorInPalette(cell.Style.ForegroundColor))

{

//add the color to the palette or use some other default color for those cells not

// in the default palette

if(colorIndex>0)

excelbook.ChangePalette(cell.Style.ForegroundColor, colorIndex--);

}

}

}

//Save the excel file.

excelbook.Save("C:\\Color_test.xls");

Thank You & Best Regards,