且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用“保存"对话框将文本另存为wordfile

更新时间:2023-02-08 09:16:49

这不是那么简单.甚至没有一点.

Word文件需要Word(或兼容的应用程序或控件)才能读取或编写它们-您不能只去这是一个Word文件-保存它",并希望.NET框架知道您的意思. br/>
如果您的开发计算机 和目标计算机 都将加载Word,则可以使用 ^ ].
如果不这样做,那么您将不得不考虑使用另一种文件格式,或者学习Word文件的内部结构(非常复杂)!

抱歉,但这是真实世界! :laugh:
It is not that simple. Not even slightly.

Word files need Word (or a compatible application or control) in order to read or write them - you can''t just go "this is a word file - save it" and expect the .NET framework to know what you mean.

If your development machine and your target machine will have Word loaded on it, you can save the file using Word Interop[^].
If you don''t, then you will have to either think of a different file format to use, or learn the (pretty complicated) internals of Word files!

Sorry, but that''s the real world! :laugh: