问题
I am working on mvc web based project, and want to convert base64 string to doc/docx file using c#..I've idea about converting base64 to image file but don't have doc/docx file,have searched a lot but didn't get any solution. anyone have idea about this...? Thanks in advance..
回答1:
You can simply create rtf file
Add system.windows.forms
reference to your project
RichTextBox rtb = new RichTextBox();
rtb.Text = "Base64String";
rtb.Save("Path");
And about creating docx file
Use this open source project for creating docx file like this
var doc = DocX.Create("FileName");
// Insert a paragrpah:
doc.InsertParagraph("Base64String");
// Save to the output directory:
doc.Save();
More information :
How do I create the .docx document with Microsoft.Office.Interop.Word?
Create and Manipulate Word Documents
来源:https://stackoverflow.com/questions/37496108/how-to-convert-base64-string-to-doc-docx-in-c