This is a migrated thread and some comments may be shown as answers.

Page break in exporting HTML to DOCX - solution found

0 Answers 32 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Marcin asked on 30 Nov 2016, 12:04 PM

Hi, everyone,

As far as I know, RadEditor doesn't have a page break functionality when HTML is exporting to DOCX. I've found a solution for this:


DocxFormatProvider provider = new DocxFormatProvider();
HtmlFormatProvider htmlProvider = new HtmlFormatProvider();

List<string> result = this.PrepareStringToExport(htmlPage); //result is a list with divided "pages"
RadFlowDocument newDoc = new RadFlowDocument();
RadFlowDocumentEditor newEditor = new RadFlowDocumentEditor(newDoc);
RadFlowDocument document;
foreach(string element in result)
document = new RadFlowDocument();
document = htmlProvider.Import(element);
byte[] byteArray = provider.Export(newEditor.Document);
string fileName = "filename.docx";
Utils.SendBytesAsFileToClientWithAjax(Response, fileName, byteArray);


If there is a cleaner solution, let me know


Best regards


No answers yet. Maybe you can help?

General Discussions
Asked by
Top achievements
Rank 1
Share this question