Free Support Forum - aspose.com

Dynamic Print Area Behaviour

Hi Babar


i would need a dynamic print area behaviour. Is this working with PDF-export now?

IF not, my scenario is a bit complicated:

I have an Excel File, servering as a template with a Analysis Services datasource behind.
For desgin reasons we had to convert a powerpivot table into cube formulas. In order for the sheet to hold all data we had to put some predesigned “placeholder” rows. Depending on a filter (slicer) these rows are filled or not. Unfortunately the Excel->PDF of aspose seems to handle these rows as not empty. Excel treats them as empty. So when I save the Excel as PDF through Excel, Excel cuts the unnessary pages whereas aspose (we use it because the renderresult is much better-except for this case) adds the unnessary “empty” pages to the resulting PDF.

Therefore we put in a dynamic print area, which is ignored. In Excel it is working.

Hope that is somehow understandable for you.

Thank you
Matthias

Hi Matthias,


First of all, we have split the existing thread to create a new one of your behalf because we believe your presented scenario is quite different from what was being discussed in that particular thread.

Coming back to your original concerns, I am afraid, Aspose.Cells APIs currently do not support creation, manipulation or interaction with slicers therefore you cannot control the rendering of worksheets that depend on the slicers. However, if you can share a sample spreadsheet, we can certainly work to find a solution to avoid the creation of empty PDF pages while converting your spreadsheets to PDF format. We would request you to please share a sample for our testing along with PDF files generated with Aspose.Cells as well as Excel application for comparison purposes.

Hi Barbar


attached to this post i have upload three files.
The source excel (i have deleted the datasource afterwards)
The PDF when saving wihtin Excel to PDF.
The Result when opening the Excel with Aspos and saving it as a PDF.

It is empeded into a sharpoint ExcelServices page, so here is the esseintial part of the code.

MemoryStream pdf = new MemoryStream();
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(new MemoryStream(workbook));
wb.Settings.CalcMode = CalcModeType.Automatic;
wb.Settings.RecalculateBeforeSave = true;
wb.Save(pdf, SaveFormat.Pdf);

thank you

Hi Matthias,


Thank you for the samples.

We have logged a formal request in our database under the ticket CELLSNET-43615 for the product team’s review. In case we are able to find a solution for your presented scenario before actually providing the support for Slicers, we will let you know here.

Hi Barbar


we do not need support for the slicers.
The “Calculation/Datarefresh” is done in Excel which is then saved asl XLS
“opened” in Aspose.cells and saved as PDF (as the aspose resulting PDF is much nicer).

The attached excel is the final result which needs to be “pretty” printed.
What we need is the saving of the excel (without refrehs) should be the same behaviour as saving in Excel.

thank you
Matthias

Hi Matthias,


I understand your requirements correctly, however, we need your help in identifying the problematic area in the Aspose.Cells generated PDF. Please convert the sample spreadsheet shared in your previous response against the latest version of Aspose.Cells for .NET 8.4.1.2 and highlight the issues in snapshots. Please note, your previous result was converted with Aspose.Cells for .NET 7.1.2.0.

Thank you for your continues cooperation in sorting out this problem.

Hello Barbar


unfortunately our Subscription has run out, last April.
I can try if a trial license will work.

I that would fix the problem we can consider updating.

Thank you
Matthias

Hi Matthias,


You may generate PDF in evaluation mode, as we only need the snapshots highlighting the problematic areas in the PDF. You may also get an 30 day temporary license by following the instruction provided here.

By the way, the latest version of Aspose.Cells for .NET is 8.4.1.3 at the moment so we request you to try this version.

Hello Barbar,



attached youll find the Screenshot. The issue is stil lan issue. But it semes i have some other issues aswell

Columnnames no longer vissible- but different Story.



Let me know if this helps.

Thank you

Matthias

Hi Matthias,


Thank you for sharing the screenshot. I believe you have used the spreadsheet with data to test the scenario, whereas the spreadsheet attached in this thread does not contain any data. That is the reason we are getting different results which do not show the issues with missing header and blank range marked red in the shared snapshot. It would be difficult for us to evaluate the case with blank spreadsheet so we requested earlier to provide the spreadsheet with dummy data. Please note, this thread is private so only you or Aspose team members can access the thread contents and attachments. Moreover, you may use the Contact button on the post window to send me an email while attaching the actual spreadsheet for testing. If you still concerned with the privacy of your data, please check the EULA for NDA (clause 8).

Hi Barbar


i cannot quite follow you, what you wanted me to provide you.
Attached to this, i have added 2 PDF. One is the result with Aspos 8, the other with aspose 7.

The spreadsheet is the excel as above, within an Sharepoint Excelservices environment.

I must say, that we experience a lot of problems with aspose 8 which we did not have with the previous versions , beside the current problem, which is not fixed in apose 8.

As you can see in the PDF the result of the two versions are quite different.

Hope that helps
regards
Matthias

Hi Matthias,


I have checked your provided PDF files and surely there are many differences in the two PDF files. The problem we are facing right now is that the spreadsheet you have shared does not contain any data so we cannot compare the results produced from the provided spreadsheet to the results shared by you. We have requested several times in this thread to provide the actual spreadsheet or with dummy data in it so we can provide it to the product team highlighting the differences. If you opt to provide the spreadsheet with dummy data, we request you to provide it’s result as well for comparison purposes.

I hope you understand what we require.

I got your point. I just rechechek my previous attachments…

I thought i have sent you already a version with data, …src.xslx.
But it is useless to you.

Attached is a version with data… sorry for the missunderstanding.

regards
Matthias

Hi Matthias,


Thank you for providing the sample spreadsheet. We are currently performing a few tests with this sample, and we will shortly get back to you with updates in this regard.

Hi Matthias,


Thank you for your patience with us.

This is to inform you that we have done some testing by generating the PDF files from your provided spreadsheet while using the latest version of Aspose.Cells for .NET 8,4.2.2 & Excel 2013. We then compared the results to highlight the differences as in attached snapshot. The aforesaid said results along with the source spreadsheet have been shared with the product team for further investigation. Please allow us some more time to thoroughly check the scenario and get back to you with updates in this regard.

Hello Barbar


I am sorry i have uploaded the wrong testfile.
Our main concern is the “too many” pages result of apsoe, whereas Ecel delivers the correct pages.
No empty pages.

I have uploaded the spreadsheet that is working with excel -when exporting.
Sorry for the inconvenience.

regards
Matthias

Hi Matthias,


No problem. Let me perform a few tests with recently shared spreadsheet and get back to you with updates in this regard.

Hi again,


Please try the latest version of Aspose.Cells for .NET 8.4.2.5 as it generates one PDF page for your recently shared spreadsheet without using additional settings. You can further tweak the rendering process by setting the PdfSaveOptions.OnePagePerSheet to true in order to make sure that one worksheet is rendered onto one PDF page.

C#

var book = new Workbook(“D:/Excel_DynamicPrintArea.xlsx”);
book.Save(“D:/output.pdf”, new PdfSaveOptions() /{ OnePagePerSheet = true}/);

Hello Barbar


sorry did not have time to test that again earlier.
Attached the result. not very good looking.

I think I must reattach a sheet again,
The printarea was updated by excel before the save.

In excel you shoud end up with two pages, aspose renders around 5.

thank you
Matthias

Hi Matthias,


First of all, you are not trying the latest version of Aspose.Cells for .NET 8.4.2.5 on your side. Please give a try to the latest version (link shared in my previous response) and share the resultant PDF if you notice the problem of multiple pages. Please note, I have reevaluated the case with the latest version against your recently provided spreadsheet, and I am unable to notice the said problem. Aspose.Cells is generating one page PDF for the given spreadsheet. Please check the attached PDF for your reference.

As you mentioned that Print Area is being updated manually using Excel before saving the spreadsheet, could you please provide the cell area on which Print Area is mapped?