在 .NET 中设置扩展文件属性
如果您需要修改 Word 或 PDF 文档中的 Company 字段值或其他扩展文件属性,您可以使用以下方法来做到这一点.NET:
安装 NuGet 包:
将以下 NuGet 包添加到您的项目:
using Microsoft.WindowsAPICodePack.Shell; using Microsoft.WindowsAPICodePack.Shell.PropertySystem; string filePath = @".\example.docx"; var file = ShellFile.FromFilePath(filePath); // Read the old properties string[] oldAuthors = file.Properties.System.Author.Value;
以上是如何使用 .NET 修改 Word 或 PDF 文档中的扩展文件属性(如公司)?的详细内容。更多信息请关注PHP中文网其他相关文章!