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 Oct 31, 2016 9:16 pm

Hi,

I am facing a problem when trying to access page horizontal breaks with Spire.
I need to get the row number of the these horizontal page breaks.

No matter what I try, I get this once I try to use the PageBreak.

"Unable to cast object of type 'Spire.Xls.Core.Spreadsheet.XLSHPageBreak to type Spire.Xls.HPageBreak"

lWorkBook:= lWorkBook.Workbook;
lWorkBook.LoadFromFile('C:\NAV\name.xlsx',FALSE);
lWorkSheets := lWorkBook.Worksheets;
lWorkSheet := lWorkSheets.Item('Ark1');
lPageBreaks1 := lWorkSheet.HPageBreaks; //lPageBreaks1 = Spire.Xls.Collections.HPageBreaksCollection.'Spire.XLS, Version=7.11.1.7040, Culture=neutral, PublicKeyToken=663f351905198cb3'

//MESSAGE(FORMAT(lPageBreaks1.Count)); //This works fine...

lPageBreak1 := lPageBreaks2.Item(0); //lDoes not work ! lPageBreak1 = Spire.Xls.Core.IHPageBreak.'Spire.XLS, Version=7.11.1.7040, Culture=neutral, PublicKeyToken=663f351905198cb3'

pedgaard
 
Posts: 24
Joined: Fri May 20, 2016 3:12 pm

Tue Nov 01, 2016 8:21 am

Hi pedgaard,

Thanks for your inquiry.
Please try to use explicit conversions, convert lPageBreaks2.Item(0) to type Spire.Xls.HPageBreak.
If there is still issue, please provide us entire code you were using for investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Nov 02, 2016 9:37 am

Hi,

I just checked again, and no luck.

Here is code - might look strange to you, as this is Microsoft Dynamics NAV C/AL code - that gets converted to C#.

lWorkBook:= lWorkBook.Workbook;
lWorkBook.LoadFromFile('C:\NAV\name.xlsx',FALSE);
lWorkSheets := lWorkBook.Worksheets;
lWorkSheet := lWorkSheets.Item('Ark1');
lPageBreaks1 := lWorkSheet.HPageBreaks;
lPageBreak1 := lPageBreaks1.Item(0); //Cast error


Please try and see if you can access a workbooks individual pagebreak items without cast error

pedgaard
 
Posts: 24
Joined: Fri May 20, 2016 3:12 pm

Thu Nov 03, 2016 4:04 am

Hi pedgaard,

Thanks for your information again.
I have noticed the issue and posted it to our Dev team. We will inform you when it is fixed.
Sorry for inconvenience.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Nov 04, 2016 6:18 am

Thank you.

pedgaard
 
Posts: 24
Joined: Fri May 20, 2016 3:12 pm

Wed Nov 09, 2016 7:55 am

Hi pedgaard,

Thanks for your waiting.
Now the issue has been resolved in Spire.XLS Pack Hotfix Version:7.11.13, welcome to test it.

Best wishes,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Nov 09, 2016 9:23 am

I will test immediately.

pedgaard
 
Posts: 24
Joined: Fri May 20, 2016 3:12 pm

Wed Nov 09, 2016 9:35 am

Thank you, the issue has been solved.

pedgaard
 
Posts: 24
Joined: Fri May 20, 2016 3:12 pm

Thu Nov 10, 2016 1:23 am

Dear pedgaard,

Thanks for your feedback.
Please feel free to contact us if there is any question.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS