.net - Rtf to WordML Convert in C# -
i have windows application generate report. has templates in rtf "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 arial;}}\r\n\\viewkind4\\uc1\\pard\\fs20\\tab\\tab\\tab\\tab af\\par\r\n}\r\n"
, written word doc file. word saved-as xml , close. then, tags (say) extracted , new
the problem here word, used converter in process , consumes valuable time in loop, opens word instance, save, close, delete.
please correct mistake if have made , me alternative convert wordml .
use aspose .words
//your rtf string string rtfstrx = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 arial;}}\r\n\\viewkind4\\uc1\\pard\\fs20\\tab\\tab\\tab\\tab af\\par\r\n}\r\n" //convert string bytes memory stream byte[] rtfbytex = encoding.utf8.getbytes(rtfstrx); memorystream rtfstreamx = new memorystream(rtfbytex); document rtfdocx = new document(rtfstreamx); rtfdocx.save(@"c:\temp.xml", saveformat.wordml);
this saves rtf text in new document wordml. cannot time take in loop. surely have less time ms word being physically opened , closed.
Comments
Post a Comment