{"id":24240,"date":"2024-05-27T15:40:56","date_gmt":"2024-05-27T07:40:56","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=24240"},"modified":"2024-05-27T15:40:56","modified_gmt":"2024-05-27T07:40:56","slug":"word%e5%ae%8f%e5%b0%81%e8%a3%85%e6%88%90exe%e8%a6%81%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/24240\/","title":{"rendered":"word\u5b8f\u5c01\u88c5\u6210exe\u8981\u600e\u4e48\u505a\uff1f"},"content":{"rendered":"
\u5c06 Word \u5b8f\u5c01\u88c5\u6210\u53ef\u6267\u884c\u6587\u4ef6\uff08exe\uff09\u53ef\u4ee5\u65b9\u4fbf\u7528\u6237\u5728\u6ca1\u6709\u5b89\u88c5 Microsoft Office \u7684\u60c5\u51b5\u4e0b\u8fd0\u884c Word \u5b8f\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u51cf\u5c11\u7528\u6237\u7684\u64cd\u4f5c\u6b65\u9aa4\u5e76\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5c06 Word \u5b8f\u5c01\u88c5\u6210 exe \u6587\u4ef6\u3002<\/p>\n
\u9996\u5148\uff0c\u9700\u8981\u4f7f\u7528 Visual Studio \u5de5\u5177\u6765\u521b\u5efa C# \u7a0b\u5e8f\u3002\u5728 Visual Studio \u4e2d\uff0c\u65b0\u5efa\u4e00\u4e2a Windows \u7a97\u4f53\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u5728\u7a97\u4f53\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u201cButton\u201d\u6309\u94ae\u3002\u5728\u5355\u51fb\u6309\u94ae\u65f6\uff0c\u8be5\u7a0b\u5e8f\u5c06\u4f1a\u8c03\u7528 Word \u5b8f\u3002<\/p>\n
\u63a5\u4e0b\u6765\uff0c\u9700\u8981\u5c06 Word \u5b8f\u5d4c\u5165\u5230 C# \u7a0b\u5e8f\u4e2d\u3002\u9996\u5148\uff0c\u6253\u5f00 Word \u6587\u4ef6\u5e76\u542f\u7528\u5f00\u53d1\u5de5\u5177\u680f\u3002\u5728\u5f00\u53d1\u5de5\u5177\u680f\u4e2d\uff0c\u70b9\u51fb\u201cVisual Basic\u201d\u6309\u94ae\uff0c\u6253\u5f00 Visual Basic \u7f16\u8f91\u5668\u3002\u5728 Visual Basic \u7f16\u8f91\u5668\u4e2d\uff0c\u9009\u62e9\u201c\u63d2\u5165\u201d\u9009\u9879\u5361\uff0c\u7136\u540e\u9009\u62e9\u201c\u6a21\u5757\u201d\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u6a21\u5757\u3002\u5728\u6a21\u5757\u4e2d\u7f16\u5199 Word \u5b8f\u4ee3\u7801\u3002<\/p>\n
\u5728 C# \u7a0b\u5e8f\u4e2d\uff0c\u9700\u8981\u4f7f\u7528 Microsoft.Office.Interop.Word \u5e93\u6765\u8c03\u7528 Word \u5b8f\u3002\u5728\u7a97\u4f53\u4ee3\u7801\u4e2d\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n
“`<\/p>\n
using System.Reflection;<\/p>\n
using Word = Microsoft.Office.Interop.Word;<\/p>\n
private void button1_Click(object sender, EventArgs e)<\/p>\n
{<\/p>\n
Word.Application wordApp = new Word.Application();<\/p>\n