Insert a document from database

Thanks you for your reply,

I think that it is because I’ ve cathed the line doc.Save(“result.doc”);

But if I don’t catch this line, I have error Access Denied pointed to this line Why ?
refer to
https://forum.aspose.com/t/128786

Why I’ ve error Access Denied on line doc.Save(“result.doc”);

I 've typed the correct path but i’ve still the same error.

I’ve search in forum but nothing helped me

Please help.

If you do something like this:

doc.Save(@"C:\MyFolder\MyFileName.doc");

And still get Access Denied and your code runs in an ASP.NET application, it probably means the ASPNET user account does not have permissions to write into that folder.

It is not Aspose.Word problem, but a basic issue that every .NET developer should be able to resolve without extra help. Please read MSDN about developing .NET applications as we will not be able to provide such exhaustive help in Aspose forums.

An ASP.NET application usually runs under the ASPNET user account and this account must have read and write NTFS permissions into the folder you are writing to.

Instead of this solution, is it possible to insert text from XML document to a report document (word) and keep format text XML (style, police,etc…) ?

For the time being you can insert XML data via mail merge (in the form of dataset), but if you need to keep formatting, maybe inserting HTML would be better solution?

Thank you,
I want to insert text by keeping format. If this solution is possible by inserting HTML, I’ll choose it.

Is it the same way as XML file ?
So I’ll transform my word doc to HTML doc.

<table border="0" cellspacing="0" width="100%"><tr><td width="15"></td><td bgcolor="lightgrey" width="15"></td><td bgcolor="lightgrey">
<font face="Lucida Console, Courier" size="2">
 <systeme codesys="SSFLEXI1S">
 <Title>_App</Title>
 <Contents>...........</Contents>
 </systeme>
 </font>
 </td></tr></table>

How can I transform this XML text to HTML for Mail merge ?

We want to choose the section or tne document to insert.

You should manually (or using XSLT) transform your XML data into HTML. For instance, Aspose.Word does not know how data in your <Title> element should be formatted - maybe like <h1>, but maybe just like.

This solution does not work : error specific cast is not valid,
But how can we insert just HTML docs to document report ?

Use the DocumentBuilder.InsertHtml method.