The PDF document is okay. But the Word-document looks good. Only the size of the Word-document, it has to send by e-mail, is much too big (17MB).
I have to open the Word document again to change the PageSettings to be sure, that the page-margins and the print orientation are correct.
Expand|Select|Wrap|Line Numbers
- using System;
- using Microsoft.Office.Interop.Word;
- namespace PageSetup
- {
- class TestPageOrientation
- {
- static void Main(string[] args)
- {
- var app = new Microsoft.Office.Interop.Word.Application();
- app.Visible = true;
- //Load Document
- Document document = app.Documents.Open(@"C:\Temp\myDocument.docx");
- // I've added this rows below. ...And that works
- document.Sections.First.PageSetup.Orientation = WdOrientation.wdOrientLandscape;
- document.Sections.Last.PageSetup.Orientation = WdOrientation.wdOrientLandscape;
- document.PageSetup.Orientation = WdOrientation.wdOrientLandscape;
- // ... and this. But the LeftMargin I can leave it.
- document.PageSetup.LeftMargin = 1.00F;
- document.Save();
- }
- }
- }
I think there is something wrong with my document sections, because the documents (with a lot of tables, graphics and a image) is much too big. And that's only after using this method.
So my next question is: How can I shrink the size of this Word document?
And what do I have to do to limit the amount of format-settings in this word-document?