groupdocs-viewer / GroupDocs.Viewer-for-.NET-UI

UI - User Interface for GroupDocs.Viewer for .NET document viewer and automation API.
MIT License
5 stars 2 forks source link

Excel documents heavily impacted by print breaks #59

Open brendancolebf opened 2 months ago

brendancolebf commented 2 months ago

What happened: Excel documents are broken up by their page breaks. Each page is rendered with a button along the bottom row as if they're sheets, but these are duplicated for each page of each sheet. These pages also appear to not render beyond the 2nd or 3rd.

What you expected to happen: If possible, Excel documents should be rendered by sheet, rather than by print margins. If this can't be achieved, the experience should be improved to make it more obvious you're previewing by page rather than by sheet.

It should also be possible to preview more than just the first few pages.

How to reproduce it: I've attached a small Excel document I created to reproduce the issue. Within Excel, you can see by enabling Page Layout > Gridlines > Print that there's a page break on each column. This is also apparent by checking the print preview in File > Print. Excel Test.xlsx

When previewing, it will be rendered with a tab for each page, and in my testing, occasionally the 4th page will get stuck on Loading. image

Source code sample: N/A

Environment:

vladimir-litvinchik commented 2 months ago

@brendancolebf

Thank you for reporting this issue. To display a complete worksheet you set the following configuration in your Program.cs file.

builder.Services
        .AddControllers()
        .AddGroupDocsViewerSelfHostApi(config =>
        {
            config.SetLicensePath("c://license//GroupDocs.Viewer.lic");

            config.ConfigureHtmlViewOptions(viewOptions => {
                viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();
                viewOptions.SpreadsheetOptions.RenderGridLines = true;
                viewOptions.SpreadsheetOptions.RenderHeadings = true;
            });
        })
        .AddLocalStorage("./Files")
        .AddLocalCache("./Cache");

I have added the following lines

config.ConfigureHtmlViewOptions(viewOptions => {
    viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet(); // render complete worksheet
    viewOptions.SpreadsheetOptions.RenderGridLines = true; // render grid lines 
    viewOptions.SpreadsheetOptions.RenderHeadings = true; // render headings
});

Make sure to cleanup Cache folder and run the app one more time with dotnet run. Select the file and the output will be the following:

viewer-three-worksheets

Sample app: sample-viewer-app.zip

We'll consider enabling this options by default in future version.

To test all the features you can get a temporary license. There are a couple of steps that should be performed:

  1. Go to https://purchase.groupdocs.com/buy and select Product Family

    select-product-family
    1. Click Add to Cart button. click-add-to-cart
  2. Create account and continue after you log in.

  3. Click Proceed on the next page.

    click-proceed
  4. Enter contact information and make sure to enter proper email address. Click Get a temporary license.

    click-get-temporary-license
  5. Check you mail box.

Now you can set a proper path to the temporary license in Program.cs file e.g.

config.SetLicensePath("c://license//GroupDocs.Viewer.lic");

Let us know if you have any questions.

brendancolebf commented 2 months ago

I really should have checked the documentation better, my apologies. I can see the merits of both, so it's hard to say which should be the default.

Thanks for the quick resolution.

vladimir-litvinchik commented 2 months ago

@brendancolebf

No problem! Let us know if you have any questions.

Have a nice day!