Using Aspose.Cells for Java we are creating a workbook where the first tab is a sheet, the second tab is a line graph (generated from data on the third tab's sheet), and the third tab is a sheet. and we specifically assign a color to each line. (red, green, blue, etc)
We save the resulting xls file and if we open with MS Excel on a MS Windows machine the line chart looks good, if we transfer the xls file to a Mac and open with MS Excel 2008 all of the lines in the line graph are black. This also happens if we generate the workbook from a Mac as well. I have attached a zip file that includes 2 workbooks, one where the tabs are; sheet, line, sheet and the other is line, sheet, line.
We are using Aspose.Cells for Java 2.1.2.0 (I did try 2.2.0.0, 2.2.1.0 and 2.3.0.0 with the same results)
Some of the other things I have tried: - If the line graph is the first tab the colors work. - All other graph types (area, stacked bar, cluster bar, pie) work fine. - All line graphs that are created on a tab that follows a sheet tab have black lines. - On a workbook that has line graph with black lines I moved the tab to be the first tab and saved it. Then I reopened and it still has black lines. - I manualy created a workbook in MS Excel 2003 on Windows where the tabs are sheet, graph, sheet, saved it. Opened it with MS Excel 2008 on Mac and the line chart shows colored lines. - We updated Excel 2008 for Mac to latest update.
After further
investigation, we found even creating a chart in MS EXCEL of windows
mannually, the color may be shown as black in Excel of Mac. For example,
following steps in MS Excel of windows will create an Excel file which cannot
be shown correctly for chart's color in the Excel of Mac:
1)create a
new workbook and add a chartsheet behind the first worksheet
2)creat aline
chart in the chartsheet and use the first worksheet as datasource
3)set the
color of line as blue (chose theblue color as attached palette.jpg shows)
4)save the
excel file
5) view it
in Excel of Mac, the chart line will be shown as black.
so, wethinkit is
not completelycompatible for Excel of Windows and Excel of Mac.
Now, we
have provided a new method for SaveOptions:
public void
setForMac(boolean isForMac)
It sets whether the workbook will be
saved for Mac OS.
Parameters: isForMac whether the workbook will be saved for
Mac OS.
Before
saving the workbook, please invoke workbook.getSaveOptions().setForMac(true).
Thus, the saved chart colors will be shown as they should be in the Excel of
Mac.
This didn't solve the problem. I am still getting all black lines.
I invoked workbook.getSaveOptions().setForMac(true) just before I invoke workbook.save(out, fileFormatType); where fileFormatType is EXCEL2003
The attached MacProcess.xls file is the workbook created this way.
I was able to manually duplicate the problem in Excel 2003 by choosing a color in the lower part of the palette. What is odd is this only occurs for line charts. All other of my chart types work great. (Area, Pie, Bar types)
Also, I just tried to create an EXCEL2007 workbook with the Aspose.Cells you posted and I get a nullPointer exception trying to save any workbook when I have a chart tab in the workbook. If all the tabs are sheets then it creates a workbook OK…
For the issue of line chart color, we will check it further. For the
issue of saving to Excel2007 workbook, would you please give
us the test code to reproduce the issue? We have done some tests but
could not reproduce such an issue.