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();
}
}
}
Word ライブラリ ソースでどのように機能するのかわかりません。しかし、私は WdOrientation.wdOrientPortrait を試してみましたが、一度は驚きました。このページは横向きで見ました。
ドキュメント (多くの表、グラフィックス、画像を含む) が大きすぎるため、ドキュメント セクションに何か問題があると思います。そして、それはこの方法を使用した後でのみです。
次の質問は、この Word 文書のサイズを縮小するにはどうすればよいですか?
そして、このワード文書のフォーマット設定の量を制限するにはどうすればよいですか?