开发者

Selecting and tagging specific formatting in word documents

开发者 https://www.devze.com 2022-12-09 08:08 出处:网络
being in need to 开发者_Go百科export a DOC file to TXT and then reimport it without losing bold and underline formatting I\'d need a macro to do that.

being in need to 开发者_Go百科export a DOC file to TXT and then reimport it without losing bold and underline formatting I'd need a macro to do that.

My idea is to select each group of words in bold (could be a sentence or a single word in sentence) and then write say <$> before it and <$$> after it. When back in word the reverse should happen, i.e. all text between <$> and <$$> back to bold. The same macro works for underline and bold+underline. I tried to export doc to html, then open in an html editor and save as txt saving only the bold and underline tags. Perfect, if not for the CR LF that the editor puts at the end end of each line...

TIA, my macro programming skills are short of basic...

alberto


Could you provide some example document for the original file and file you processed? If it is only about CR and LF, you can replace them via VBA:

textasstring = Replace$(textasstring, vbCrLf, "") textasstring = Replace$(textasstring, vbLf, "")

Another solution is to take an editor which is able to support extended search and replace including \r and \n like notepad++.

0

精彩评论

暂无评论...
验证码 换一张
取 消