We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Missing images in word document

Received : 2007/06/28 09:50:42
Message : Hello,

I’m using C#.Net to open a Word document via the IO.Stream supplied by an ASP.net FileUpload control. Once the document opened the program perform numerous operations successfully including Mail-Merge, document insertion and bookmark deleting. Untouched programmatically is a front page which contains some images laid out within a table. When the document saved back to Page.Respose object (IO.Stream again) the images are missing. Can you help?

King regards
George


This message was posted using Aspose.Live 2 Forum

Hmm, we need to be able to reproduce the problem on our side to be able to fix the problem.

Try to comment out document processing operations one by one in your code to find out exactly what code causes the images ещ disappear. After that please attach the initial document and the code so that we could reproduce and fix the problem.

Best regards,

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);
}





Thanks for providing additional info. I will check the issue and let you know tomorrow.

Thanks for providing additional information. I have reproduced the defect and logged it to our defect base as issue #3263. It seems to be a bug in DOC writer so to work around you can temporarily use other word document format to save to, i.e. RTF or WordML. We will try to fix this problem ASAP. Sorry for inconvenience.

Hi,


The above was part of prototype function for a project bid. I therefore don’t mind using the work around until the defect can be fixed. Are you able from your experience to give an estimation of when this defect might be fixed?


Many thanks for the quick response and the fine workaround, your help has been much appreciated.


Kind regards

George




We will probably fix it by the time of the next release in a couple of weeks, provided there would be no complications like the need for serious redesign or the presence of some obscure undocumented feature of MS Word. Anyway, I will keep you informed of our progress.

Best regards,

Any update on the status of this bug fix?

Thanks

Hi

Unfortunately, this bug is unresolved yet. A notification will be posted here in this thread as soon as it will be done.

Best regards.

I've looked at this issue. The problem is that the picture is a FILL picture for the background of the rectangle shape. Picture fills are not supported for DOC files in Aspose.Words because we could not figure out so far how they are stored (remember DOC is undocumented).

To workaround, you simply need to insert this picture as a normal picture into the document (not as a background fill of a shape) and Aspose.Words will process it well.

The issues you have found earlier (filed as 3263) have been fixed in this update.