是否有替代创建依赖于Wordpad而不是Word的RTF文档? [英] Is there an alternative to creating an RTF document that depends on Wordpad instead of Word?

查看:64
本文介绍了是否有替代创建依赖于Wordpad而不是Word的RTF文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

' This code creates an RTF document in the next to last line.  This requires
' that Word is installed.  Is there a different way that requires only Wordpad
' because it is usually present when office is not installed?

' Create document.
        WordApp = CreateObject("Word.Application")

        If WordApp.Visible = True Then WordApp.Visible = False
        WordApp.Assistant.Visible = False
        thisDoc = WordApp.Documents.Add
        thisDoc.PageSetup.PaperSize =    Microsoft.Office.Interop.Word.WdPaperSize.wdPaperLetter
        thisDoc.PageSetup.TopMargin = 0
        thisDoc.PageSetup.BottomMargin = 0
        thisDoc.PageSetup.HeaderDistance = 0
        thisDoc.PageSetup.FooterDistance = 0
        thisDoc.PageSetup.LeftMargin = 72
        thisDoc.PageSetup.RightMargin = 72
        thisDoc.Range.InsertBefore(currentName)
        thisRange = thisDoc.Paragraphs.Item(1).Range
        thisRange.Font.Name = "Segoe UI Semibold"
        thisRange.Font.Bold = True
        thisRange.Font.Size = 14
        thisRange.ParagraphFormat.Alignment _
      = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphLeft

        ' Save document.
        frmSrv1.Text = "Saving document..."
        TopicFileName = topicDir & "\" & srvFilesFldN & "\" & progID & thisAppID & topicN & "." & srvExt
        thisDoc.SaveAs(TopicFileName, RichTextBoxStreamType.RichText)
        thisDoc.Close

推荐答案

Rtf文件是MS单词独立。请参阅: http://en.wikipedia.org/wiki/Rich_Text_Format [ ^ ] - 实施部分。 Fianlly,我需要警告你: RTF规范缺少读取,编写和修改文档所需的一些语义定义。



我建议使用OpenXML,请参阅:如何:操作Office打开XML格式文档 [ ^ ]
Rtf file is MS Word independent. Please see: http://en.wikipedia.org/wiki/Rich_Text_Format[^] - Implementations section. Fianlly, i need to warn you: "The RTF specifications lack some of the semantic definitions necessary to read, write and modify documents."

I'd suggest to use OpenXML, see: How to: Manipulate Office Open XML Formats Documents[^]


这篇关于是否有替代创建依赖于Wordpad而不是Word的RTF文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆