Create option to set maximum zoom limit.

In the viewer (FlexCelPreviewer) the maximum zoom is 400%, but in some cases I need a higher zoom level.

Can you create a property to define the maximum zoom limit (greater than 400%) or eliminate the routine that defines the maximum zoom level as 4?

Than you.

There are 2 issues here:

  1. The zoom is saved in the file, and it can't be bigger than 400% or Excel won't understand it:
    image

  2. FlexCelPreviewer isn't really designed to work with higher zooms. It will of course work with some more (there is nothing magical in the number 400 more than it was what Excel choose), but if you up the zoom a lot more, then the bitmaps that cache the page will get huge. To really do it "right", we should review the current approach of caching one page for faster rendering to caching parts of the page. Which is more complex due to the text coming from previous cells.

Point 1 I guess could be workarounded by letting you set a bigger zoom, but never saving into the file more than 400. Point 2. could be solved by changing the caching approach or just trying to remove the limit and see how it works. The memory for an image grows quadratically, so I don't expect to be able to reach huge zoom levels, but maybe it if is something like 800% it might work.

I wonder what is the use case you have for more than 400% zoom? 400% is quite big already, and if it is not readable at that zoom, it will likely not be legible if you try to print it. Is it to try to create a "pseudo grid" instead of print previewing? If that is the case, maybe the efforts are best spent creating just that (which is in our mid-term plans already). For print-previewing (the reason of FlexCelPreviewer to exist) I am not sure that more than 400% zoom is really needed, and if we can be consistent with the 400% zoom max in Excel, I think that's good.

I'm creating some reports in Flexcel where the user can select which information they want to display (these reports will never be printed)

To allow the user to see all columns in a single row, the report will be set to one page width.

If the user selects a large number of information, he will not be able to read the information on the screen and must save it as XLSx and then open it in Excel.

For this specific condition, I need a Zoom greater than 400%.

If I eliminate the display in one page width, the user will have difficulty finding the information they need and will have to save it in XLSx and open it in Excel.

As it is not possible to implement a higher zoom level, I will export the spreadsheet in PDF and then open it in PDFToolKit (which has no zoom level limitation).

I think the preview revamp we are planning (which might even be a new component) should take care of this case in a better way. It will behave like a normal grid, so there will be no need to have a "one page width".

But right now, I think the simplest solution is just to make the page bigger. It doesn't need to be A4, and it doesn't need to be portrait. Just setting the page to A3 in landscape should allow for a much larger display. And since you are not printing, you can just make the page width as long as you want. (but remember, very huge pages could have performance issues)

Making the page larger will also solve another issue you would face with a huge zoom. While in theory a vector image is infinitely scalable, the truth is that having a tiny image zoomed thousands of times is going to have accumulated rounding errors which will make the zoomed image not that good. The numbers are discrete single-precision floats, and they have errors when you go too small.

Excellent suggestion :-)

This solved my problem.

In my viewer, in the button where I increase the zoom level, I changed it to:

procedure TCons_Ger.pZoomInClick(Sender: TObject);
Var
    wI, wF: Integer;
    wRefresh: Boolean;
begin
    if FlexCelPreviewer1.Zoom < 4 then
    Begin
       FlexCelPreviewer1.Zoom:=FlexCelPreviewer1.Zoom + 0.1;
       Exit;
    End;
    if wXLS.PrintPaperSize = TPaperSize.A2 then
       Exit;
    wF:=wXLS.ActiveSheet;
    wRefresh:=False;
    for wI := 1 to wXLS.SheetCount do
    Begin
       wXLS.ActiveSheet:=wI;
       case wXLS.PrintPaperSize of
          TPaperSize.A4, TPaperSize.Undefined: 
                         Begin
                            wXLS.PrintPaperSize:=TPaperSize.A3;
                            wRefresh:=True;
                         End;
          TPaperSize.A3: Begin
                            wXLS.PrintPaperSize:=TPaperSize.A2;
                            wRefresh:=True;
                         End;
       end;
    End;
    if wF <> wXLS.ActiveSheet then
       wXLS.ActiveSheet:=wF;

    if wRefresh then
       FlexCelPreviewer1.InvalidatePreview;
end;

Thank you.