- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
简要介绍一下背景,我有很多笔记,我15年前以wpd格式打字,大约10年前,我将它们转换为rtf格式,现在我想将它们转换为html。我看过的所有 php 示例都使用非常基本的 html。我想采用的方式涉及嵌套列表。
http://dl.dropbox.com/u/47490038/ech.rtf
https://dl.dropbox.com/u/47490038/notes/index.html
到目前为止,我已经使用了下面的宏,从 rtf 到 txt,但是现在 php 部分超出了我的范围,其中一些可以通过计算每行开头的制表符或空格来完成,请参阅上面的 url 以获得所需的输出。我可以稍后添加其他样式。
我愿意接受有关如何执行此操作的建议,即使它是我不熟悉的语言。即使是宏,我也不是很满意,我希望能够在 word 之外选择一个文件夹或文件,考虑到我有 100 个要转换,甚至可能是拖放的东西。
Sub ChangeDocsToTxtOrRTFOrHTML()
'with export to PDF in Word 2007
Dim fs As Object
Dim oFolder As Object
Dim tFolder As Object
Dim oFile As Object
Dim strDocName As String
Dim intPos As Integer
Dim locFolder As String
Dim fileType As String
On Error Resume Next
locFolder = InputBox("Enter the folder path to RTFs", "File Conversion", "C:\myDocs")
Select Case Application.Version
Case Is < 12
Do
fileType = UCase(InputBox("Change DOC to TXT, RTF, HTML", "File Conversion", "TXT"))
Loop Until (fileType = "TXT" Or fileType = "RTF" Or fileType = "HTML")
Case Is >= 12
Do
fileType = UCase(InputBox("Change DOC to TXT, RTF, HTML or PDF(2007+ only)", "File Conversion", "TXT"))
Loop Until (fileType = "TXT" Or fileType = "RTF" Or fileType = "HTML" Or fileType = "PDF")
End Select
Application.ScreenUpdating = False
Set fs = CreateObject("Scripting.FileSystemObject")
Set oFolder = fs.GetFolder(locFolder)
Set tFolder = fs.CreateFolder(locFolder & "Converted")
Set tFolder = fs.GetFolder(locFolder & "Converted")
For Each oFile In oFolder.Files
Dim d As Document
Set d = Application.Documents.Open(oFile.Path)
strDocName = ActiveDocument.Name
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
ChangeFileOpenDirectory tFolder
Select Case fileType
Case Is = "TXT"
strDocName = strDocName & ".txt"
ActiveDocument.SaveAs FileName:=strDocName, FileFormat:=wdFormatText
Case Is = "RTF"
strDocName = strDocName & ".rtf"
ActiveDocument.SaveAs FileName:=strDocName, FileFormat:=wdFormatRTF
Case Is = "HTML"
strDocName = strDocName & ".html"
ActiveDocument.SaveAs FileName:=strDocName, FileFormat:=wdFormatFilteredHTML
Case Is = "PDF"
strDocName = strDocName & ".pdf"
' *** Word 2007 users - remove the apostrophe at the start of the next line ***
'ActiveDocument.ExportAsFixedFormat OutputFileName:=strDocName, ExportFormat:=wdExportFormatPDF
End Select
d.Close
ChangeFileOpenDirectory oFolder
Next oFile
Application.ScreenUpdating = True
End Sub
我意识到我问了很多,任何指导、建议、帮助、代码都将不胜感激。
最佳答案
在我看来,您的源文档是 RTF 格式的,但它们不使用任何基于 RTF 的嵌套。是对的吗?例如,“2 级”项目符号与“1 级”项目符号的不同不是因为 RTF 中的任何内容,而是因为有人添加了更多空格?
例如,在文件中我看到很多\par 标记,但没有任何迹象表明嵌套。所以你有一个\par\ul block (例如在“原始教堂”中),然后直接进入 A.1 小节,除了一个制表符和一个祈祷(可以这么说!)
鉴于此,您不能过分依赖 RTF。我的建议是删除所有 RTF 标记,留下一个文档,其布局仅通过使用空格和制表符定义。然后,处理每一行(Perl 对此很擅长)并从空格数和前导组合的使用中计算出来,就像新列表开始一样。并相应地插入标签。
它会很难看,但这是糟糕标记的代价。
关于php - rtf 到 html 列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13938471/
有谁知道将背景颜色应用于表格单元格的 rtf 标签? 我知道表结构: {\rtf1\ansi\deff0 \trowd \clshdng10000\cellx1000 \clshdng10000
MS Exchange/Outlook 消息使用 MAPI 存储数据。一个常见的 MAPI 属性包含消息正文的富文本版本(0x1009、PR_RTF_COMPRESSED、PidTagRtfCompr
我需要以编程方式生成一个 RTF 文档,其中包含一个垂直合并列的表格,例如 ______________________________ | merged | foo | hello |
我正在尝试增加 柜台 使用以下代码在 BIP 报告的 for-each 循环中将变量增加 1。 然而,柜台 无论有多少循环,变量都不会增加。有人可以指导我如何做到这一点。 我也知道 position(
我需要在 RTF 文件中创建一个表。但是我不熟悉 RΤF。以下是这些 RTF 文件应该替换的文本文件示例: GENERAL JOURNAL
我正在尝试手动生成 RTF 文档,最终会以编程方式完成。我计划改进 pyRTF,使其可以生成“目录”,但我认为它不能。 我无法使用 RTF 控制字(\tc、\tcf 和\tcl.)生成目录。 http
如何在 rtf 中的单元格内制作表格?这是我所知道的最简单的表格: {\rtf\ansi\deff0 \trowd \intbl \cellx1000 Item 1\cell \cellx2000 I
我正在研究 RTF 解析器,但在处理 unicode 时遇到了一些困难。 RTF 规范规定“大于 32767 的 Unicode 值必须表示为负数”( http://www.biblioscape.c
我想更改 RTF 文档的内容,而不是将其另存为 RTF 文档: $defaultRtfFile>> "C:\Users\user\Desktop\Outlokk-Signature\Test.rtf"
我需要一个简单的 HTML2RTF 转换器我尝试运行以下代码...但我收到此代码示例的错误 代码: import java.io.ByteArrayInputStream; import java.i
我想编写一个 python 脚本,将文件编码从 cp949 转换为 utf8。该文件最初以 cp949 编码。我的脚本如下: cpstr = open('terms.rtf').read() utf
有哪些方法可以使用 Java 将 RTF 转换为包含 Windows 或 Unix 文档中表格的 PDF? 我们在这里尝试过的选项是: ITEXT - 但 rtf 文档中的表格在转换为 PDF 后无法
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
似乎不可能为 RTF 项目符号列表找到一个非常简单的工作示例,如下所示: 您好 世界 嵌套(但请以正方形作为项目符号) 也嵌套(也是方形项目符号) 再次定期 我尝试使用 Word 或 TextEdit
我有一个数据框 df 用于 RTF 格式的报告,如下所示: df <- ATRSLBL POPUL CENTRE BAGE BAGEC1 SEX Red PPS 3720
我正在处理由其他人在未知平台上制作的 RTF 文件,并且所有内容都被正确解释,除了一些字符,无论我在 openoffice 中打开它们的任何字符集。这是经过解释的纯文本: "Même taille q
有人知道RTF文件的linter吗? 我正在为文字处理器编写一个简单的 RTF 导出工具。我已经到了我生成的文件现在加载到 OpenOffice 并且似乎可以工作的阶段——除了我刚刚发现如果我从 Op
有人可以帮我将特殊字符转换为可以在 RTF 文件中正确表示的字符吗? 我正在获取 iPad 上存储在字符串中的文本,并使用 NSASCIIStringEncoding 将其输出为 RTF 文件。到目前
我对 RichTextBox.Rtf 属性有点困惑。我正在输入一个混合字体大小的字符串:Test 字体大小为 20,string 字体大小为 10。但是,当我查看 Rtf 时 字符串,我得到以下内容:
我正试图让一个欧元符号显示在 RTF 文档中,但我不太走运。 RTF 文档是一个模板,其中填充了来自 .Net 的数据(通过读取文本流并替换其中的标记)。这些标记之一与欧元符号有关。我的代码按预期工作
我是一名优秀的程序员,十分优秀!