Free Support Forum - aspose.com

Images are not positioned correctly when saving document in HTML

When the document is saved in HTML, all images are positioned incorrectly in the document compared to when saved in .doc. See attached Image positioned in HTML and Image Positioned in doc.

The rest of the document formats correctly.

I am using the latest version of Aspose.word .net.

The code that that is used to save the document in Html:

HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
htmlOptions.ExportXhtmlTransitional = true;
htmlOptions.ExportHeadersFootersMode = ExportHeadersFootersMode.None;
doc.Save(@serverAttachmentPath + docFileName, htmlOptions);

The code that is used to save the images:

ps = builder.PageSetup;
builder.MoveTo(cFFDPara);

int top = 0;

if (verticalOrientation == “Horizontal”)
top = 160;
else
top = 220;

if (verticalOrientation == “Vertical”)
{
ps.HeaderDistance = 40;

Double contentHeight = ps.PageHeight - ps.TopMargin - ps.BottomMargin;

create_CFFD mydiagram = new create_CFFD();
System.Drawing.Bitmap cFFDimage = mydiagram.generateCFFD(processName, Int32.Parse(exportData[“ID”].ToString()), exportData[“Name”].ToString(), null);

MemoryStream ms = new MemoryStream(ImageToByte2(cFFDimage));
Image image = Image.FromStream(ms);
double percentW, adjustedWidth, adjustedHeight;
if (image.Width > contentHeight)
{
percentW = (double)((contentWidth) / image.Width);
adjustedWidth = (image.Width * percentW);
adjustedHeight = image.Height * percentW;
}
else
{
percentW = (double)(contentWidth / image.Width);
adjustedWidth = image.Width * percentW;
adjustedHeight = image.Height * percentW;
}
Aspose.Words.Drawing.Shape shape = builder.InsertImage(cFFDimage, RelativeHorizontalPosition.InsideMargin, -40, RelativeVerticalPosition.TextFrameDefault, top, adjustedWidth, adjustedHeight, WrapType.None);
shape.Rotation = 90;
shape.DistanceTop = top;
mydiagram.Dispose();
}
else
{
contentWidth = ps.PageWidth - ps.LeftMargin - ps.RightMargin;

create_CFFD mydiagram = new create_CFFD();
System.Drawing.Bitmap cFFDimage = mydiagram.generateCFFD(processName, Int32.Parse(exportData[“ID”].ToString()), exportData[“Name”].ToString(), null);

MemoryStream ms = new MemoryStream(ImageToByte2(cFFDimage));
Image image = Image.FromStream(ms);
double percentW, adjustedWidth, adjustedHeight;
if (image.Width > contentWidth)
{
percentW = (double)(contentWidth / image.Width);
adjustedWidth = (image.Width * percentW);
adjustedHeight = image.Height * percentW;
}
else
{
percentW = (double)(contentWidth / image.Width);
adjustedWidth = image.Width * percentW;
adjustedHeight = image.Height * percentW;
}
Aspose.Words.Drawing.Shape shape = builder.InsertImage(cFFDimage, RelativeHorizontalPosition.LeftMargin, 0, RelativeVerticalPosition.TextFrameDefault, top, adjustedWidth, adjustedHeight, WrapType.None);
shape.DistanceTop = top;
mydiagram.Dispose();
}
}

Any ideas?

Regards
Paul

Hi Paul,


Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Attached is the Complete Word Doc in Doc format. The document is built from scratch in Aspose.Word based on a Template document. The Template Document is used to define Heading 1 to 5 with numbering and no numbering.

Hi Paul,

Thanks for sharing the document. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7247 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Any idea when this issue will be resolved?


Regards
Paul

Hi Paul,


Thanks for your inquiry. Unfortunately, your issue is not resolved yet. I am afraid, I cannot provide you any reliable estimate at the moment. However, our development team has planned this issue to fix it in Aspose.Words (v11.11.0) which is planned to be released by the end of December 2012.

Thanks for your patience.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The problem still exists after updating Aspose words to the latest version.

The image in the attachment should be placed under the Cross-Functional Flow Diagram heading. It is currently placed over the contents of the Predecessors.


Hi Paul,


Please accept my apologies for your inconvenience.

Thanks for your inquiry. Unfortunately, your issue is not resolved yet. This issue has been logged as WORDSNET-7551 in our issue tracking system. I have asked for the detail of this issue from our development team. As soon as, any information is shared by them, I will be more than happy to share that with you.

Thanks for your patience.

Hi Paul,


Thanks for your patience.

I have received response from our development team and like to share with you that the fix of this issue will be available in the next version of Aspose.Words (v13.2.0) which is planned to be released by the end of this month (around February’ 28, 2013).

We will inform you via this forum thread as soon as the new release is published at the end of the month.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.