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.

Thu Feb 01, 2024 6:19 am

Hello, I was facing issue with the automatic Pagebreaks that are coming up in my excel when i save it.
It considering each cell to be a pagebreak.
I even tried removing them with the VPageBreaks.Clear() and HPageBreaks.Clear() but its not working.

I was using Spire.XLS for .Net 14.0.1 with my Visual Studio 2019

Can I get some help regarding this issue.
Attachments
Spire.XLS.png
Spire.XLS.png (13.57 KiB) Viewed 801 times

vinay_0204
 
Posts: 2
Joined: Thu Feb 01, 2024 4:05 am

Thu Feb 01, 2024 6:48 am

Hello,

Thank you for your inquiry.
After carefully reviewing the screenshot you provided, it appears that the issue you are experiencing is due to the Excel file being in a view mode other than Normal. Please refer to the following code to modify the view mode of the Excel file.
Code: Select all
// Create a new Workbook object
Workbook workbook = new Workbook();

// Load the  file
workbook.LoadFromFile("input.xlsx");

// Iterate through all the worksheets in the workbook
foreach (Worksheet worksheet in workbook.Worksheets)
{
    // Set the view mode of each worksheet to Normal mode
    worksheet.ViewMode = ViewMode.Normal;
}

// Save the file using the Excel 2013 file format
workbook.SaveToFile("result.xlsx", Spire.Xls.FileFormat.Version2013);

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1652
Joined: Wed Apr 07, 2021 2:50 am

Thu Feb 01, 2024 7:05 am

Hello, Thanks for the quick response
But I Purposefully put it in PageBreak View to check the page breaks.
My Question was regarding why is it giving pagebreak to each cell ["Can i get the possible scenarios why it might be happening"] and also regarding why is the VPageBreaks.Clear() Functionality not working.

Thank you.

vinay_0204
 
Posts: 2
Joined: Thu Feb 01, 2024 4:05 am

Thu Feb 01, 2024 7:25 am

Hello,

Thank you for your feedback.
In order to help us investigate your issue efficiently and effectively, please provide the following information for our reference. You could attach them here or send them to us via email (support@e-iceblue.com). Thanks in advance.
1) Your input Excel file.
2) Your complete test code.
3) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).
4) Your application type, such as Console app (. Net 6.0).

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1652
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS