使用PowerShell将长字符串插入Word文档

时间:2019-03-02 15:13:32

标签: powershell powershell-v2.0 powershell-v3.0 powershell-v4.0

我正在尝试从文件向Word文档中插入长字符串(以替换文档[REPLACEME]中的内容)。

似乎可以插入255个字符的限制,否则,我得到一个错误:字符串参数太长。

这是CSV格式的文本:

Number, Shortcut_Name
1., "Web Connector"
2., "QuickBooks Web Connector"
3., "QuickBooks Simple Start"
4., "QuickBooks Simple Start Free Edition"
5., "QuickBooks Premier - Nonprofit Edition 2010"
6., "QuickBooks Enterprise Solutions 10.0"
7., "QuickBooks Enterprise Solutions - Accountant Edition 10.0"
8., "QuickBooks Enterprise Solutions - Contractor Edition 10.0"
9., "QuickBooks Enterprise Solutions - Nonprofit Edition 10.0"
10., "QuickBooks Enterprise Solutions - Professional Services Edition 10.0"
11., "QuickBooks Enterprise Solutions - Retail Edition 10.0"
12., "QuickBooks Enterprise Solutions - Manufacturing and Wholesale Edition 10.0"

下面的代码有效。如何使用此代码在Word文档中搜索[REPLACEME]单词并替换为以下表格输出?
Number, Shortcut_Name
1., "Web Connector"
2., "QuickBooks Web Connector"
3., "QuickBooks Simple Start"
4., "QuickBooks Simple Start Free Edition"
5., "QuickBooks Premier - Nonprofit Edition 2010"
6., "QuickBooks Enterprise Solutions 10.0"
7., "QuickBooks Enterprise Solutions - Accountant Edition 10.0"
8., "QuickBooks Enterprise Solutions - Contractor Edition 10.0"
9., "QuickBooks Enterprise Solutions - Nonprofit Edition 10.0"
10., "QuickBooks Enterprise Solutions - Professional Services Edition 10.0"
11., "QuickBooks Enterprise Solutions - Retail Edition 10.0"
12., "QuickBooks Enterprise Solutions - Manufacturing and Wholesale Edition 10.0"

0 个答案:

没有答案