BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
|
// Opens the file as Stream.
StreamReader docStream = new StreamReader( new FileStream(@"Chinese.txt", FileMode.Open, FileAccess.Read), Encoding.GetEncoding("GB2312")); //Writes the text into stream.
MemoryStream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream,new UTF8Encoding()); writer.Write(docStream.ReadToEnd()); writer.Flush(); //Dispose the stream docStream.Dispose(); stream.Position = 0; //Opens the text file in Word document object.
WordDocument document = new WordDocument(stream, Syncfusion.DocIO.FormatType.Txt); // Create a custom style to preserve chinese text in Word document. WParagraphStyle paragraphStyle = document.Styles.FindByName("Normal") as WParagraphStyle; paragraphStyle.CharacterFormat.Font = new System.Drawing.Font("SimSun", 12); document.Save("Output.docx"); |