This project has moved and is read-only. For the latest updates, please go here.

Zoomscale Property

Mar 4, 2012 at 1:47 AM

Hi,

I tried calling 

ExcelWorksheet.View.ZoomScale

In order to attempt to set the default zoom.  I can't figure out what proper values for it should be and there don't seem to be any examples.  Any time I run it (with whatever values I choose), I get an error:

KeyNotFoundException - "The given key was not present in the dictionary"

Not sure at all what this means, but is Zoomscale currently supported?  And, if it is, how do I use it?

Mar 19, 2013 at 9:28 AM
Hi,

This seems to be working in v3.1.2 at least, e.g.
using (var package = new ExcelPackage(new FileInfo(@"c:\file.xlsx"), true))
{
    ExcelWorksheet ws = package.Workbook.Worksheets[1];
    ws.View.ZoomScale = 78;
    package.Save();
}
This sets the zoom level of the first worksheet to 78%.