Hello,
We have implemented such features of our application using FlexCel library:
- generate Excel reports from datasets;
- export Excel reports into PDF files.
We have found out some problems with the export to PDF when the source Excel file contains Pie charts.
The color palette and the position of data labels are distorted, as you can see comparing the source Excel file and the PDF export result. We can't attach files to the ticket. Please provide email address to send them.
Our application doesn't generate charts by FlexCel; it uses pre-designed Excel file as a template and just fills the data cells with external data, a presentation part of the report still be unchanged. So this issue occurs if the template is designed in Excel 2007, as the certain report has been. If a template is created in one of previous Excel versions, such as Excel 2003, the colors are exported properly, and the labels mostly too.
Concerning colors, we suppose that it may be caused by difference of color palette support in Excel 2003 and 2007.
Our application runs in such environment:
- Windows 2003 Server R2 & SP2 (reproduced locally in Windows 7 too);
- .NET 3.5;
- FlexCel.dll of versions 4.9.6.0 and 5.5.0.0
The stable application version uses 4.9.6.0, but this problem occurs for both FlexCel versions.
This is a source code of a method that exports Excel file to PDF. It has been called with such parameter values:
aExportAllSheets = false
aPageSize = "Legal"
aPageOrient = "portrait"
-----------------------------------------------------------------------------------------------------------------
protected FlexCel.Render.FlexCelPdfExport flexCelPdfExport_ = null;
public void exportFile(string aXlsFile, string aPdfFile, bool aExportAllSheets, string aPageSize, string aPageOrient)
{
flexCelPdfExport_.Workbook = new XlsFile();
flexCelPdfExport_.Workbook.Open(aXlsFile);
ExcelFile xls = flexCelPdfExport_.Workbook;
xls.PrintOptions |= TPrintOptions.LeftToRight;
flexCelPdfExport_.Kerning = true;
using (FileStream pdfStream = new FileStream(aPdfFile, FileMode.Create))
{
int saveSheet = xls.ActiveSheet;
try
{
flexCelPdfExport_.BeginExport(pdfStream);
if(aExportAllSheets)
{
for(int i = 1; i <= flexCelPdfExport_.Workbook.SheetCount; i++ )
{
flexCelPdfExport_.Workbook.ActiveSheet = i;
if(aPageOrient=="landscape")flexCelPdfExport_.Workbook.PrintOptions = TPrintOptions.LeftToRight;
flexCelPdfExport_.Workbook.SheetZoom=100;
flexCelPdfExport_.Workbook.PrintGridLines = xls.PrintGridLines;
flexCelPdfExport_.Workbook.PrintScale=xls.PrintScale;
flexCelPdfExport_.Workbook.PrintPaperSize =(TPaperSize) Enum.Parse((new TPaperSize()).GetType(),aPageSize,true);
flexCelPdfExport_.ExportSheet();
}
}
else
{
flexCelPdfExport_.ExportSheet();
}
flexCelPdfExport_.EndExport();
}
finally
{
xls.ActiveSheet = saveSheet;
}
}
}
Hi,
Well, after some more digging, it happens that FlexCel 5 does support Excel 2007 colors in charts, at least basic support. I had forgotten that (and I wrote the code...). Can you please send me the files so I can have a better idea of what the issues are?
Thank you Adrian.
I am ready to send files.
Please provide your email address.
Thank You.
Adrian email was sent to You.
Thanks.
Thanks, I got it and will investigate what can be done. Issues with the labels seems to mostly because Excel basically saves 2 versions of the chart inside the xls file (one for Excel 2007 and the other so 2003 can read it), and the Excel 2003 version /the one we read) seems to be wrong. (As you can see by opening this file in Excel 2003).
Thanks You.
Waiting for update from You.
Adrian, any updates on this issue ?
Hi,
Adrian Thank you.
When You plan to deliver version 6 ?
Realistically, I wouldn't expect it before half of 2012. There is a lot of work to do to create a chart rendering engine for xlsx, and thousands of cases to test. And we have to deliver 5.7 first.
I see. Please contact us when this fix will be avialable.