1

我们使用 PDF-Focus。我们希望将横向格式的 PDF 文档导出为 Word 文档。我们想将此文档导出到 Word。我们在 Word 中获取文档。一切看起来都很好。如果我们想打印这个新的 word 文档,这个文档的边距是纵向的。

我试图通过创建一个空的 Word 文档然后插入一个临时导出的 Word 文档来解决这个问题。然后我将方向更改为横向。我看到这个解决方案有效。该文档现在是横向的。

但是现在带有图形和其他图像的页面与带有表格的页面重叠。

所以我想我必须通过读取单独的页面然后循环插入来将临时文档插入到新创建的文档中。

我们应该使用哪个功能以编程方式解决这个问题?或者也许有更好的解决方案?你能帮助我吗?

卫斯理

4

3 回答 3

0

以下代码适用于我并打开一个更改其页面方向的 word 文档。你在找这样的东西吗?

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");

            document.PageSetup.Orientation = WdOrientation.wdOrientLandscape;
        }
    }
}
于 2012-07-27T11:34:31.763 回答
0
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 文档的大小

我该怎么做才能限制这个word文档中格式设置的数量?

于 2012-07-31T13:23:43.067 回答
0

问题是 PDFFocus 将 PDF 转换为 RTF 格式。而且如果更改设置,文档的大小会快速增长

所以我解决了这个问题,首先将其保存为带有RTF-extension的 RTF-document 。然后我将此文档另存为 Word97-document 并带有DOC-extension

对于这两种转换,我都有相同的文档名称。两者都带有 DOC 扩展名。 另存为 Word97 文档不起作用。我认为这是 Word 2007 的错误。

于 2012-09-10T09:27:46.243 回答