Free Support Forum - aspose.com

Images gone with .Doc format but not with WordML format

We insert images into wordML and then use Aspose to create a Word Doc using that wordML.
We use the Aspose .Doc format for saving to file…

When we do that our images are not visible in the document.
In checking out the resulting wordML it appears that all the wordML tags necessary are there.
However, the style has been changed from what we had:
<v:shape id="_x0000_i1025" type="#_x0000_t75" style=“width:0px;height:0px”>

to

<v:shape id="_x0000_i1025" type="#_x0000_t75" style=“width:.75pt;height:.75pt”>

If I modify what aspose converted it to back to width:0px;height:0px the image shows up…

If I change to using the ASPOSE WordML save type…the images show up fine (but we lose any embedded objects like visio diagrams…etc).

We would prefer to use the .Doc save format.

Any idea why Aspose is converting our style?

~ Clint
ps. We use custom Xml tags. Our pictures exist inside those xml tags. Since you guys are stripping out our tags…perhaps you are doing something in that logic to mess with the style???


Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your inquiry. CustomXML is not fully supported in the current version of Aspose.Words. We plan to support custom XML and structured document tags in the next versions of Aspose.Words.

Best regards.

Thanks Alexey…However…

Please note that you guys are at least preserving the non-custom Xml inside the custom Xml tag…which is great.

Our problem is that Aspose is converting the height and width to ".75px " which is too small to be seen. The image Xml is not custom…so shouldn’t that be supported?



Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please attach your document for testing? I will investigate the problem and provide you more information.

Best regards.

Thanks. The attached document it is straight wordML…
We typically open another word document using ASPOSE (host Document) and then open our WordML (contentDocument) like the one attached by streaming it into an Aspose.Words.Document…

Then we merge the contentDocument into the hostDocument…and save…
You can create a normal word document to act as your hostDocument for your test…

Aspose.Words.Document hostDocument = new Document(hostFilePath);

byte[] buffer = System.Text.Encoding.UTF8.GetBytes(wordML);
MemoryStream kbriefStream = new MemoryStream(buffer);

Aspose.Words.Document contentDocument = new Document(kbriefStream, string.Empty, LoadFormat.Auto, string.Empty);


hostDocument.Sections.Clear();
foreach (Section srcSection in contentDocument)
{
Node dstSection = hostDocument.ImportNode(srcSection, true,
ImportFormatMode.UseDestinationStyles);
hostDocument.AppendChild(dstSection);
}

…then later write it out to file using:
hostDocument.Document.Save(this.filePath, SaveFormat.Doc);

If we use Doc format then you cannot see the picture because the height/width are modified to .75px.
If we use WordML style then it shows up fine in the resulting document.


~Clint
PS. The picture you should see as a result would be a guitar.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem and created new issue #6494 in our defect database. I will notify you as soon as it is fixed.

Best regards,

Hi,

Can you let me know why do you have image size specified as zero in your WML? Aspose.Words “corrects” it to 0.75pt because in MS Word documents zero shape size is invalid in some places. For example, setting shape size zero is not allows in MS Word user interface. So rather than let invalid data through, Aspose.Words gently corrects the document. If you have a proper size in your WML then Aspose.Words is likely to process it better. Especially now, when Custom XML is supported in Aspose.Words.

The issues you have found earlier (filed as WORDSNET-5014) have been fixed in this .NET update and in this Java update.