Export to PDF chart different from Excel version - 2

Ok. Here’s my issue. Please fix the issue with displaying nulls as zeroes in the long/short exposure chart for the attached XLS template. You can use the same code snippet from before, which I am reincluding below.

//Create an instance of workbook from QuantSheet excel template
var xlt = new WorkbookDesigner();
var wb = new Workbook(Page.MapPath(“QuantSheetTemplate.AsposeTest.xls”));

xlt.Workbook = wb;
xlt.Process();

if (IsExcelOutput)
{
//Output workbook to Excel using Aspose.Cells
wb.Save(Page.Response, “QuantSheet.xls”, ContentDisposition.Attachment, new XlsSaveOptions());
}
else
{
//evaluate worksheet formulas (otherwise they won’t be represented in the pdf output)
wb.CalculateFormula();
//make all sheets invisible except for the first worksheet
for (int i = 1; i < wb.Worksheets.Count; i++)
wb.Worksheets[i].IsVisible = false;
wb.Save(this.Response, “QuantSheet.pdf”, ContentDisposition.Attachment, new PdfSaveOptions());
}

Hi,

Thanks for your code example.

I have little modified code and ran it using latest version:
Aspose.Cells
for .NET v7.2.1.4

and got three output files. I have attached these files.

Source File:
QuantSheetTemplate.AsposeTest.xls

Output Files:
QuantSheetTemplate.AsposeTest.xls.out.xls (no problem it is correct)
QuantSheetTemplate.AsposeTest.xls.out.xlsx (no problem it is also correct)
QuantSheetTemplate.AsposeTest.xls.out.pdf (it has problems as shown in screenshot)

I see the problems in Pdf output only, both xls and xlsx output are fine. I have shown the screenshot of output pdf.

Let me know if I got your problem right or if I miss anything.

Please see the code below that I used for testing.

C#


string filePath = @“F:\QuantSheetTemplate.AsposeTest.xls”;

//Create an instance of workbook from QuantSheet excel template
var xlt = new WorkbookDesigner();
var wb = new Workbook(filePath);

xlt.Workbook = wb;
xlt.Process();

bool IsExcelOutput = true;

if (IsExcelOutput)
{
//Output workbook to Excel using Aspose.Cells
///wb.Save(Page.Response, “QuantSheet.xls”, ContentDisposition.Attachment, new XlsSaveOptions());
wb.Save(filePath + “.out.xlsx”);
}
else
{
//evaluate worksheet formulas (otherwise they won’t be represented in the pdf output)
wb.CalculateFormula();

//make all sheets invisible except for the first worksheet

for (int i = 1; i < wb.Worksheets.Count; i++)
wb.Worksheets[i].IsVisible = false;


///wb.Save(this.Response, “QuantSheet.pdf”, ContentDisposition.Attachment, new PdfSaveOptions());
wb.Save(filePath + “.out.pdf”);
}

Screenshot:

Yes, that is exactly right. The problem is with the PDF output only. If you fix that I will be very happy! :slight_smile:

Hi,

Thanks for your input.

I have brought this issue forward and logged it with separate ticket and increased its priority.

Development team will soon look into it and fix the problems and once the issue is resolved, we will soon let you know.

This issue has been logged as CELLSNET-40700.

Hi,

We are afraid, we don’t support displaying nulls as gaps for 2003 format file (xls) . According to the Ms.Excel 2003 specification, Ms.Excel 2003 display nulls as zero and don’t support displaying nulls as gaps.

If we support this feature, some users will complain to us, “Why the generated chart image is not same as chart in Ms.Excel 2003”.

For your requirement, we think the following code will generate the pdf as desired by you. I have attached the output pdf and screenshot for your reference.

C#


string filePath = @“F:\Downloads\QuantSheetTemplate.AsposeTest.xls”;


//Create an instance of workbook from QuantSheet excel template

var xlt = new WorkbookDesigner();

var wb = new Workbook(filePath);


xlt.Workbook = wb;

xlt.Process();


bool IsExcelOutput = false;


if (IsExcelOutput)
{

//Output workbook to Excel using Aspose.Cells

///wb.Save(Page.Response, “QuantSheet.xls”, ContentDisposition.Attachment, new XlsSaveOptions());

wb.Save(filePath + “.out.xlsx”);

}
else
{

//evaluate worksheet formulas (otherwise they won’t be represented in the pdf output)
wb.CalculateFormula();


//make all sheets invisible except for the first worksheet
for (int i = 1; i < wb.Worksheets.Count; i++)
wb.Worksheets[i].IsVisible = false;


for (int i = 0; i < wb.Worksheets[0].Charts.Count; i++)
{
Chart c = wb.Worksheets[0].Charts[i];

if (c.Type == ChartType.Area)
{

//If chart is area chart, generate 2007 format chart image.
wb.FileFormat = FileFormatType.Xlsx;


MemoryStream sChart = new MemoryStream();

c.ToImage(sChart, ImageFormat.Emf);


wb.FileFormat = FileFormatType.Excel97To2003;


//Add the generated image to the chart for overlaping the original chart that is 2003 format

c.Shapes.AddPictureInChart(0, 0, sChart, 100, 100);


//Hide the original chart.

c.NSeries.Clear();

}//if

}//for



///wb.Save(this.Response, “QuantSheet.pdf”, ContentDisposition.Attachment, new PdfSaveOptions());

wb.Save(filePath + “.out.pdf”);


}//else


Screenshot:

Your workaround does seem to get rid of the problem with treating the null values as zeroes. However, it seems that the line/border widths for the area chart are now much thicker than the other charts and the chart title seems to have disappeared. Is there a way to fix these issues?

Hi,

Thanks for your input.

We have logged your issues in our database. We will look into them and provide you a workaround.

Could you please highlight all of them in a screenshot with red circles around them?

Your comment has been logged against the issue id: CELLSNET-40700

Why is it incumbent on me to keep sending you guys documents with red circles? I feel I am spending half of my work week debugging your product for you. And it is getting very frustrating. Can you not see the missing title in the chart from the 2 screenshots that you attached to this post?

Hi,


We apologize for the inconvenience you have faced. Your feedback till yet has been very useful for our development team and we are working to fix this issue. We will update you soon about this after hearing from our development team. We appreciate your patience in this regard.

Hi,

Thanks for your posting.

Yes, we have already seen the problem and working over it. The problem arises because we have to switch between xls and xlsx format for getting chart images and rendering in pdf output.

I think, it is not easy to get rid of it.

I have also logged your comment against the issue id: CELLSNET-40700

We will soon get back to you.

<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-US;mso-fareast-language:
EN-US;mso-bidi-language:AR-SA”>Hi,



Please download and try the latest fix: Aspose.Cells
for .NET v7.2.1.7


We have fixed your issue.

<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif”;
mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>Please run the
attached code segment using new fix.

Thanks.


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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.