Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Nov 28, 2011 4:29 pm

Hi. A year ago I posted about problems setting print area on a Worksheet. Unfortunately due to time constraints I wasn't able to keep trying to make it work. Today I've decided to give a try to version 6.0 and I've noticed I'm still having issues with print area. The thing is that it works perfectly if I save the workbook in xls (2003 format) but not on xlsx (2007).

The code to reproduce the issue is:

Code: Select all
         
           Workbook wb = new Workbook();
           wb.CreateEmptySheets(1);
           Worksheet ws = wb.Worksheets[0];
           ws.Range[3,2].NumberValue = 10;
           ws.Range[1, 2].NumberValue = 30;
           ws.PageSetup.PrintArea = ws.Range[1, 2, 2, 3].RangeAddressLocal;
           wb.SaveToFile(@"c:\printarea.xls",ExcelVersion.Version97to2003);


This works fine and excel prints only "30". But if I replace last line with:

Code: Select all
           wb.SaveToFile(@"c:\printarea.xlsx",ExcelVersion.Version2007);


Excel prints both "10" and "30" which is incorrect because it's out of print region.
I'm using version 6.0.7 (hotfix), Visual Studio 2008 Sp1, .NET Framework 3.5 SP1 and Excel 2007.

I really hope this time you'll be able to reproduce the issue with the provided code because this problem is the only thing keeping me from buying your tool.

Thanks in advance.

darkcamper
 
Posts: 13
Joined: Mon Sep 27, 2010 5:31 pm

Tue Nov 29, 2011 2:53 am

Hello darkcamper,

Sorry for any inconveniences caused by us and thank you for your patience.

I have tested the code you sent, but I didn't come up with the problem you had. You can view the result in the "view" lable. I sent you the screenshots.
PS:
I used the latest Spire.XLS HotFix 6.0.8. You can download it from the following address:http://www.e-iceblue.com/Download/download-excel-for-net-now.html

Please try again. If you still have any other questions, please don't hesitate to contact us.

Have a nice day.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Tue Nov 29, 2011 2:57 am

Hello darkcamper,

Sorry for missing the screenshorts.

Have a nice day.
Attachments
PrieView.zip
(27.89 KiB) Downloaded 453 times
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Tue Nov 29, 2011 11:24 am

Hi, I've tried again on a few more computers with the following Excel versions (all of them are Spanish versions)

2007 Version (12.0.4518.1014) MSO (12.0.6036.5000)
2007 SP2 Version (12.0.6565.5003) MSO (12.0.6562.5003)
2010 (I couldn't get exact version sorry)

With same results. Looking inside the contents of the .xlsx file I've noticed an (apparently) significant difference between a Spire.XLS generated on and an Excel modified one. With Spire.XLS the print area is stored inside workbook.xml as follows:

Code: Select all
  <definedNames>
    <definedName name="Print_Area" localSheetId="0">
    'Sheet1'!B1:C2</definedName>
  </definedNames>


But when I modify print area inside Excel 2007 it's saved as... :

Code: Select all
    <definedName name="_xlnm.Print_Area" localSheetId="0">
    Sheet1!$A$1:$B$2</definedName>


I'm including an attachment with both .xlsx files and screenshots of each one so you can see the result on my computer. I hope this could help you bring some light upon this obscure issue :)

Thanks!
Attachments
PrintArea.zip
(108.23 KiB) Downloaded 582 times

darkcamper
 
Posts: 13
Joined: Mon Sep 27, 2010 5:31 pm

Wed Nov 30, 2011 3:04 am

Hello darkcamper,

Thank you for your patience.

I am sorry that we can't reproduce your problem.

If you want to set PrintArea by MS Excel, you need to set the "print select" under the File tab. After doing that you would find that the "PrintArea" generated by Spire.XLS is the same as MS Excel's. I attaced the XML file and screenshorts of the result to you. Please check it.

If you still have any other questions, please don't hesitate to contact us.

Have a nice day.
Attachments
Result.zip
(36.45 KiB) Downloaded 664 times
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Return to Spire.XLS