The operations of opening and saving the document causes the images to disapear. I’ve attached the word document along with the following code.
Kind regards,
George
<!-- Here’s the asp .net file Default.aspx --!>
<asp:FileUpload ID=“FileUpload1” runat=“server” />
<asp:Button ID=“Button1” runat=“server” Text=“Transform” OnClick=“Button1_Click” />
<asp:Label ID=“Label1” runat=“server” ForeColor=“Red”></asp:Label>
<!-- Here’s the code behide file Default.aspx.cs --!>
protected void Button1_Click(object sender, EventArgs e)
{
try
{
if (!(FileUpload1.HasFile))
throw new Exception(“No file has been selected to transform.”);
if (!(FileUpload1.FileName.EndsWith(".doc")))
throw new Exception(“You’ve selected a document type that isn’t supported”);
TransformDocument(FileUpload1.PostedFile.InputStream, Response, FileUpload1.FileName);
}
catch (Exception ex)
{
Label1.Text = "Error: " + ex.Message;
}
}
private void TransformDocument(Stream inputDocument, HttpResponse responseOutput, string fileName)
{
//MergeTemplate mergeTemplate = new MergeTemplate( new ProjectDB() );
Document wordDocument = new Document(inputDocument);
//MergeMarks mergeMarks = new MergeMarks(wordDocument);
//foreach (MergeMark mergeMark in mergeMarks)
// mergeMark.Import( mergeTemplate );
wordDocument.Save(fileName, SaveFormat.Doc, SaveType.OpenInWord, responseOutput);
}