하나의 옵션은
string html = "<html><head><style>p{margin:0}</style></head><body style=\"font-family:Arial;\">" + value.Replace("<p> </p>", "<p><br></p>") + "</body></html>";
byte[] htmlBytes = Encoding.UTF8.GetBytes(html);
string htmlPath = Path.GetTempFileName() + ".html";
string rtfPath = htmlPath.Replace(".html", ".rtf");
FileStream fs = new FileStream(htmlPath, FileMode.Create, FileAccess.Write);
fs.Write(htmlBytes, 0, htmlBytes.Length);
fs.Close();
Application word = new Application();
Document doc = word.Documents.Open(htmlPath);
doc.SaveAs(rtfPath, WdSaveFormat.wdFormatRTF);
doc.Close();
word.Quit();
fs = new FileStream(rtfPath, FileMode.Open, FileAccess.Read);
byte[] rtfBytes = new byte[fs.Length];
fs.Read(rtfBytes, 0, rtfBytes.Length);
fs.Close();
string rtf = Encoding.ASCII.GetString(rtfBytes);
Thread thread = new Thread(() =>
{
RichTextBox rtb = new RichTextBox();
rtb.Rtf = rtf;
rtf = rtb.Rtf;
});
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
return rtf;
말씀이 말씀의 RTF 파일이 매우 부피가 큰 것을 그대로 나는뿐만 아니라하여 RichTextBox를 사용한 이유 ... (일부에 의해 눈살을 찌푸리게하지만)가 MS 오피스 워드 상호 운용성을 사용하는 것입니다 ... Word의 RTF 데이터가 RichTextBox에 입력되면 불필요한 코드가 모두 필터링됩니다.
jquery rte 구문과 word rte 구문이 같지 않다고 생각합니다. –
어떻게 전환을 달성 할 수 있습니까? –