I have some HTML content, which I want to export to “Docx” format using Aspose.Words .NET.
I have used the following code snippet:
Document doc = new Document();
string strContent = “
This is some content
”;
byte[] byteArray = GetBytes(strContent);
FileStream f = new FileStream(“yourfile.docx”, FileMode.Create);
f.Write(byteArray, 0, byteArray.Length);
doc.Save(f, SaveFormat.Docx);
I basically want to show a “Save file dialog” when exporting this content as “docx” in an ASP.NET webform.
However, when I run the above code, there is no exception, and no file is being exported.
Can you please let me know the proper code for exporting content to Docx along with the Save file dialog?
If you need to use Aspose.Words in ASP.NET application, I would recommend you use Aspose.Words.dll from .NET 2.0 folder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml("**This is some content**");
// Send the document in Word format to the client browser with an option to save to disk.
doc.Save(Response, "output", ContentDisposition.Attachment, new OoxmlSaveOptions());
Response.End();
Thanks for your inquiry. While using the latest version of Aspose.Words i.e. 13.12.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-9589. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.
I also wanted to mention a related issue: When exporting Html content to Docx, any comments added by the user against any content are not being exported at all.
Example Html: normal content
added with track changes
When the above Html is exported, the comments are not being exported at all.
Can you please add this issue as well to the bug tracking issue WORDSNET-9589.
Is it a public bug tracking system? Can I have a look at it?
Unfortunately, there is no direct way you can track issues by yourself. But, you are welcome to ask your issue status via forum threads. We will verify the status from our internal issue tracking system and reply you back.
But, when you convert this Html fragment to Word format using Microsoft Word 2013, you’ll observe the same behavior. In this case, Aspose.Words’ Html engine mimics the behavior of Microsoft Word. Please refer to the Annotation Features Supported on HTML Import section.
If we can help you with anything else, please feel free to ask.
Thanks for your inquiry. We will provide an ability to preserve comments during “Html to Word to Html” round-trip in Aspose.Words 14.1.0 - Jan 2014 release. Your request has been linked to the appropriate issue (WORDSNET-8647) and you will be notified as soon as this feature is supported. Sorry for the inconvenience.
Regarding WORDSNET-9589, our development team has completed the work on this issue and has come to a conclusion that this issue and the undesired behaviour you're observing is actually not a bug in Aspose.Words. So, we will close this issue as 'Not a Bug'.
To fix this issue, please supply the "DateTime" in tag in the following format:
<inscite="RadEditorUser"datetime="2014-01-31T19:10:50Z">Added
some content</ins>
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.