RemoveBlankPages

RemoveBlankPages(string, string)

从文档中删除空白页并保存输出。返回已删除页码的列表。

public static List<int> RemoveBlankPages(string inputFileName, string outputFileName)
范围类型描述
inputFileNameString输入文件名。
outputFileNameString输出文件名。

返回值

页码列表已被视为空白并被删除。

例子

展示如何从文档中删除空白页。

// 有几种方法可以从文档中删除空白页:
string doc = MyDir + "Blank pages.docx";

Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.1.docx");
Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.2.docx", SaveFormat.Docx);

也可以看看


RemoveBlankPages(string, string, SaveFormat)

从文档中删除空白页,并以指定格式保存输出。返回已删除页码的列表。

public static List<int> RemoveBlankPages(string inputFileName, string outputFileName, 
    SaveFormat saveFormat)
范围类型描述
inputFileNameString输入文件名。
outputFileNameString输出文件名。
saveFormatSaveFormat保存格式。

返回值

页码列表已被视为空白并被删除。

例子

展示如何从文档中删除空白页。

// 有几种方法可以从文档中删除空白页:
string doc = MyDir + "Blank pages.docx";

Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.1.docx");
Splitter.RemoveBlankPages(doc, ArtifactsDir + "LowCode.RemoveBlankPages.2.docx", SaveFormat.Docx);

也可以看看


RemoveBlankPages(string, string, SaveOptions)

从文档中删除空白页,并以指定格式保存输出。返回已删除页码的列表。

public static List<int> RemoveBlankPages(string inputFileName, string outputFileName, 
    SaveOptions saveOptions)
范围类型描述
inputFileNameString输入文件名。
outputFileNameString输出文件名。
saveOptionsSaveOptions保存选项。

返回值

页码列表已被视为空白并被删除。

也可以看看


RemoveBlankPages(Stream, Stream, SaveFormat)

从输入流提供的文档中删除空白页,并将更新后的文档 以指定的保存格式保存到输出流。返回已删除页码的列表。

public static List<int> RemoveBlankPages(Stream inputStream, Stream outputStream, 
    SaveFormat saveFormat)
范围类型描述
inputStreamStream输入流。
outputStreamStream输出流。
saveFormatSaveFormat保存格式。

返回值

页码列表已被视为空白并被删除。

例子

展示如何从文档流中删除空白页。

using (FileStream streamIn = new FileStream(MyDir + "Blank pages.docx", FileMode.Open, FileAccess.Read))
{
    using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.RemoveBlankPagesStream.docx", FileMode.Create, FileAccess.ReadWrite))
        Splitter.RemoveBlankPages(streamIn, streamOut, SaveFormat.Docx);
}

也可以看看


RemoveBlankPages(Stream, Stream, SaveOptions)

从输入流提供的文档中删除空白页,并将更新后的文档 以指定的保存格式保存到输出流。返回已删除页码的列表。

public static List<int> RemoveBlankPages(Stream inputStream, Stream outputStream, 
    SaveOptions saveOptions)
范围类型描述
inputStreamStream输入流。
outputStreamStream输出流。
saveOptionsSaveOptions保存选项。

返回值

页码列表已被视为空白并被删除。

也可以看看