个人中心

联系我们

搜索
搜索 登录 免费注册
界面美化
业务优化
开发工具
图像管理
文档管理
Parasoft

新闻资讯

关注工具软件产品最新动态,了解软件开发行业新趋势。

Aspose 使用教程:将 Publisher 文件转换为 Word

原创
软件开发
来源:Aspose
Aspose
Microsoft
word
格式转换
文档格式
文件格式
PDF
API
C#
C/C++
Java
2024-04-29
Aspose
Microsoft
word
格式转换
文档格式
文件格式
PDF
API
C#
C/C++
Java


Microsoft Publisher 是一种广泛使用的工具,用于制作有吸引力的小册子、传单和其他类型的出版物。然而,当涉及到共享或协作出版商文件时,使用出版商文件可能会有点压力。在这种情况下,我们可以将 PUB 转换为 Word。在本文中,我们将探索一个免费的在线工具,将 Publisher 文件在线转换为 Word。


将 PUB 在线转换为 Word - 将 PUB 转换为 DOCX

使用这款免费的 PUB 到 Word 在线转换器应用程序将 Publisher 文件转换为 Word 文档,并将输出保存为 DOCX 格式。它完全在网络浏览器中运行,无需额外软件。



如何将 PUB 文件转换为在线 Word

  1. 拖放 PUB 文件,或使用在线链接从 OneDrive、Google Drive 等处访问文件。

  2. 单击 "转换 "按钮执行 PUB 转换。

  3. 输出的 DOCX 格式文件将可供下载。

  4. 将生成的 DOCX 文件保存到电脑或移动设备中。

为保护您的隐私,您的数据不会存储在我们的服务器上。出于安全考虑,下载链接将在 24 小时后失效。


将 Publisher 文件转换为 Word:开发人员指南

作为开发人员,您可以通过两个步骤轻松地将 Publisher 文件 (PUB) 转换为 Word 文档。首先,使用 Aspose.PUB API 将 PUB 文件转换为 PDF 格式。然后,使用 Aspose.PDF API 将 PDF 页面转换为 DOCX 格式。


以下部分提供了在 .NET 或 Java 中以编程方式将 PUB 文件转换为 Word 的步骤和代码示例。


  • 在 C# 中将 Publisher 文件转换为 Word

  • 在 Java 中将 Publisher 文件转换为 Word

  • 在 C++ 中将 Publisher 转换为 Word


用 C# 将 Publisher 文件转换为 Word

通过以下步骤,我们可以用 C# 将任何 PUB 文件轻松转换为 Word 文档:


  1. 在应用程序中安装 Aspose.PUB for .NET 和 Aspose.PDF for .NET。

  2. 使用以下代码示例加载 PUB 文件并将其转换为 DOCX 格式。

以下代码示例展示了如何在 C# 中将 PUB 文件转换为 Word 文档。

// This code example demonstrates how to convert PUB to DOCX in C#.
using Aspose.Pdf.Devices;
using Aspose.Pdf;
using Aspose.Pub;
// Initialize a MemoryStream to hold output document
MemoryStream stream = new MemoryStream();
// Load the input PUB file
Aspose.Pub.IPubParser parser = Aspose.Pub.PubFactory.CreateParser("Sample.pub");
// Parse the input publisher file
Aspose.Pub.Document doc = parser.Parse();
// Convert the PUB file to PDF and save result in a MemoryStream
Aspose.Pub.PubFactory.CreatePdfConverter().ConvertToPdf(doc, stream);
// Load input PDF file from the MemoryStream
Aspose.Pdf.Document document = new Aspose.Pdf.Document(stream);
// Initialize DocSaveOptions class object
Aspose.Pdf.DocSaveOptions options = new DocSaveOptions();
// Specify the format of output word file (DOC/DOCX)
options.Format = DocSaveOptions.DocFormat.DocX;
// Save output word file (DOC/DOCX)
document.Save("PUBToWord.docx", options);


用 Java 将 Publisher 文件转换为 Word

同样,我们也可以通过以下步骤在 Java 中将 PUB 文件转换为 DOCX:


  1. 在应用程序中安装 Aspose.PUB for Java 和 Aspose.PDF for Java。

  2. 使用以下 Java 代码加载 PUB 文件并将其转换为 DOCX 格式。

以下代码示例展示了如何在 Java 中将 PUB 文件转换为 Word 文档。

// This code example demonstrates how to convert PUB to DOCX in Java.
// Initialize ByteArrayOutputStream to hold intermediary PDF file.
final ByteArrayOutputStream os = new ByteArrayOutputStream();
// Initialize Pub Parser for the PUB file
IPubParser parser = PubFactory.createParser("Sample.pub");
// Parse the Publisher file
com.aspose.pub.Document doc = parser.parse();
// Convert PUB to PDF file and save output into the stream
PubFactory.createPdfConverter().convertToPdf(doc, os);
// Load the intermediary PDF document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(os.toByteArray());
// Convert or Export the file to MS Word DOCX or DOC format
pdfDocument.save("PUBToDOCX.docx", SaveFormat.DocX);


用 C++ 将 Publisher 文件转换为 Word

我们还可以通过以下步骤用 C++ 将 PUB 文件转换为 DOCX:


  1. 在您的应用程序中安装 Aspose.PUB for C++ 和 Aspose.PDF for ++。

  2. 使用以下 C++ 示例代码加载 PUB 文件并将其转换为 DOCX 格式。

以下代码示例展示了如何在 C++ 中将 PUB 文件转换为 Word 文档。

// This code example demonstrates how to convert PUB to DOCX in C++.
// Source PUB and output PDF file paths
System::String filePub = u"C:\\Files\\Sample.pub";
System::String filePdf = u"C:\\Files\\Output.pdf";
// Load the PUB file
System::SharedPtr<IPubParser> parser = PubFactory::CreateParser(filePub);
System::SharedPtr<Aspose::Pub::Document> document = parser->Parse();
// Convert the PUB file to PDF
PubFactory::CreatePdfConverter()->ConvertToPdf(document, filePdf);
// Load the generated PDF file
auto pdfDocument = MakeObject<Aspose::Pdf::Document>(filePdf);
// Create an instance of the DocSaveOptions class
auto saveOptions = MakeObject<Aspose::Pdf::DocSaveOptions>();
// Set the format as DocX
saveOptions->set_Format(DocSaveOptions::DocFormat::DocX);
// Save the DocX file
pdfDocument->Save(u"C:\\Files\\PUBToWord.docx", saveOptions);


结论

总之,将 Publisher 文件转换为 Word 是一种简单而有效的方法,可以让你的文档更易于访问和使用。按照本文概述的步骤,你可以选择使用在线 PUB 到 DOCX 转换工具或开发自己的转换应用程序,将 PUB 文件转换为 Word 格式。如果有任何不清楚的地方,请随时联系我们


联系我们

周一至周日 8:00-23:00

免费热线

023-62585653

张经理:13082556879

罗经理:17558866126

许经理:13057566525

开发外包

ERP-一体化

小程序

企业微信客服

版权所有:重庆庚乾信息科技有限公司 ©2025 Gengqian Information Technology Co., Ltd. 渝ICP备2022008063号-2 渝公网安备50010702505508

版权所有:重庆庚乾信息科技有限公司

©2025 Gengqian Information Technology Co., Ltd. 渝ICP备2022008063号-2 渝公网安备50010702505508