Excel template done in HTML for export: how to set the excel zoom percentage?

Amegi18

New Member
Joined
Mar 18, 2013
Messages
9
Hi, I am tasked to export a data table done in visualforce (using apex), into an excel file.

I can already export the data into an excel file. The display is also ok when exported to excel.
My problem is that, I do not know how to code in HTML, in such a way that the exported excel file will
automatically be in 80% zoom. It always opens in 100% zoom.

I can't find solutions from other forums ...
Please help ... m(_ _)m

* the code is so far purely apex and html only..
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
What type of Excel file are you creating? For an Excel 2007 workbook the zoom setting is held in the worksheet's xml part, eg:

HTML:
-<sheetViews>
    <sheetView workbookViewId="0" zoomScaleNormal="80" zoomScale="80" tabSelected="1"/>
</sheetViews>
 
Upvote 0
Hi, thank you SO much for the reply. ^_^

Any version of Excel would be fine. What I'm aiming for though is the '.xls' files.

I'm sorry, I haven't done any xml before so I don't really know how to insert that code.
If it's not too much to ask, may I request at least all the other xml tags i need to insert for that piece of code to work?

Thanks... m(_ _)m
 
Upvote 0
Add into the head part (before its end tag for example) of HTML code this one:

HTML:
<xml>
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetOptions>
     <x:Zoom>80</x:Zoom>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
 </x:ExcelWorkbook>
</xml>

Have tested this with Excel 2003 – it works.
 
Last edited:
Upvote 0
Thank you! Thank you ^_______^

I believe this will work ..
Now I just have to find a work around on how to write xml codes within apex.
- It throws error . Says "Unknown component x:excelworkbook"

(I am working in visualforce. I just started in visualforce so I don't really know yet if xml within an apex page is possible. I do know however that javascript can be inserted within the page)
 
Last edited:
Upvote 0
Try googling Apex code to write an XML file
Here is one of the link with the code: How to write xml in apex class

XML code can store any user's or application's tag, x:excelworkbook is the tag for Excel application
 
Last edited:
Upvote 0
Hope you will subjugate apex :)
Good luck!
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,011
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top