Reputation: 695
This answer is strangely vacant from the internet, or my google-fu is getting rusty.
I'm making an excel file from C# via xml... When it loads up the worksheet width is pitifully small. Using <ss:WindowWidth>13395</ss:WindowWidth>
as prescribed by the internet does... nothing. (edit: tried this in excelworkbook and worksheetoptions, if that gives any idea to the problem) Tried with and without the ss: additions. Also, I cannot seem to find exactly why everyone uses values with this in and around the tens of thousands.
I'm thoroughly confused. If someone links a LMGTFY that answers this I'll eat my hat, because I damn well don't see it.
Silly excel. No one likes you.
Just for you L. Figured windowWidth would give the jist of it.
Upvotes: 9
Views: 1192
Reputation: 5825
I've seen some people add an ExcelWorkbook
element to the 'Workbook' element. The ExcelWorkbook
element has WindowWidth
and WindowHeight
elements.
Here is an example that lists (all?) of the child elements for the ExcelWorkbook
element.
<Workbook>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>6795</WindowHeight>
<WindowWidth>8460</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>15</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
...
</Workbook>
EDIT
The WindowWidth
element is an unsigned int that is specified in twips. Twips is defined as a twentieth of a point.
Twips Link http://en.wikipedia.org/wiki/Twip
Upvotes: 5
Reputation: 6142
You can maximize the workbook programmatically via the COM interface. In VBA you would do something like this:
ActiveWindow.WindowState = xlMaximized
Maybe that helps.
Upvotes: 0