Converting from rich text format to plain text problems

后端 未结 2 663
轻奢々
轻奢々 2020-12-21 03:33

We currently have an application (Windows service) that connects to another of our applications and grabs invoices. In the invoices there is a RTF field for the footer/heade

2条回答
  •  被撕碎了的回忆
    2020-12-21 04:05

    I ended up using this. I know that it may not parse 100% of RTF text but we ran it against our live data to test it and it works fine for our purposes.

    Regex.Replace(rtfString, @"\{\*?\\[^{}]+}|[{}]|\\\n?[A-Za-z]+\n?(?:-?\d+)?[ ]?", "");
    

提交回复
热议问题