Hi,
I am exporting Html content within RadEditor to Docx format using the following code in ASP.NET:
Telerik.WinControls.RichTextBox.Model.DocxFormatProvider provider = new Telerik.WinControls.RichTextBox.Model.DocxFormatProvider();
Telerik.WinControls.RichTextBox.Model.RadDocument document = new HtmlFormatProvider().Import(FCKeditorESI.GetHtml(EditorStripHtmlOptions.None));
Telerik.WinControls.RichTextBox.Model.RadDocument htmlDoc;
var htmlContent = FCKeditorESI.GetHtml(EditorStripHtmlOptions.None);
var importer = new HtmlFormatProvider();
var exporter = new DocxFormatProvider();
using (var stream = new MemoryStream())
{
var writer = new StreamWriter(stream);
writer.Write(htmlContent);
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
htmlDoc = importer.Import(stream);
}
//htmlDoc.Measure(RadDocument.MAX_DOCUMENT_SIZE);
//htmlDoc.Arrange(new RectangleF(PointF.Empty, htmlDoc.DesiredSize));
var bytes = exporter.Export(htmlDoc);
Response.Clear();
Response.ContentType = "application/msword";
Response.AddHeader("Content-Disposition", "attachment;filename= exportusingtelerik.docx");
Response.BinaryWrite(bytes);
Response.End();
The content is exported to "docx" format, but with the following issues:
1. The exported Word file only displays the "normal" content which was entered in RadEditor. Content which was entered with "track changes" in not exported at all.
2. When opening the "docx" file in Apache OpenOffice 4, it gives the following error:
General error.
General input/output error.
I have attached the Html content (Content.jpg) and exported document (exportusingtelerik.jpg) herewith for reference.
Is there any setting required which will export all content, including track changes and metadata information?
Thanks.
I am exporting Html content within RadEditor to Docx format using the following code in ASP.NET:
Telerik.WinControls.RichTextBox.Model.DocxFormatProvider provider = new Telerik.WinControls.RichTextBox.Model.DocxFormatProvider();
Telerik.WinControls.RichTextBox.Model.RadDocument document = new HtmlFormatProvider().Import(FCKeditorESI.GetHtml(EditorStripHtmlOptions.None));
Telerik.WinControls.RichTextBox.Model.RadDocument htmlDoc;
var htmlContent = FCKeditorESI.GetHtml(EditorStripHtmlOptions.None);
var importer = new HtmlFormatProvider();
var exporter = new DocxFormatProvider();
using (var stream = new MemoryStream())
{
var writer = new StreamWriter(stream);
writer.Write(htmlContent);
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
htmlDoc = importer.Import(stream);
}
//htmlDoc.Measure(RadDocument.MAX_DOCUMENT_SIZE);
//htmlDoc.Arrange(new RectangleF(PointF.Empty, htmlDoc.DesiredSize));
var bytes = exporter.Export(htmlDoc);
Response.Clear();
Response.ContentType = "application/msword";
Response.AddHeader("Content-Disposition", "attachment;filename= exportusingtelerik.docx");
Response.BinaryWrite(bytes);
Response.End();
The content is exported to "docx" format, but with the following issues:
1. The exported Word file only displays the "normal" content which was entered in RadEditor. Content which was entered with "track changes" in not exported at all.
2. When opening the "docx" file in Apache OpenOffice 4, it gives the following error:
General error.
General input/output error.
I have attached the Html content (Content.jpg) and exported document (exportusingtelerik.jpg) herewith for reference.
Is there any setting required which will export all content, including track changes and metadata information?
Thanks.