Free Support Forum - aspose.com

Proper Image height & width is not comming

Hi
When i am exporting one HTML file into word, the Images height, weight is not comming in proper way in word file. But when i open that HTML file its comming.

How to over come this problem, give some suitable example.

Thanks & Regards
Sreenu

Hi

Thanks for your request. Unfortunately, html styles are not supported when importing into Aspose.Word. See the following document to learn more about converting format using Aspose.Words.

http://www.aspose.com/Products/Aspose.Words/Aspose.Words.Converters.xls

Also you can parse your html and insert your images as Shapes. See the following example.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = new Shape(doc, ShapeType.Image);

shape.WrapType = WrapType.Inline;

shape.ImageData.SetImage(@"test.jpg");

shape.ImageData.Borders[BorderType.Bottom].Color = Color.Black;

shape.ImageData.Borders[BorderType.Bottom].LineStyle = LineStyle.Single;

shape.ImageData.Borders[BorderType.Bottom].LineWidth = 2;

shape.ImageData.Borders[BorderType.Left].Color = Color.Black;

shape.ImageData.Borders[BorderType.Left].LineStyle = LineStyle.Single;

shape.ImageData.Borders[BorderType.Left].LineWidth = 2;

shape.ImageData.Borders[BorderType.Right].Color = Color.Black;

shape.ImageData.Borders[BorderType.Right].LineStyle = LineStyle.Single;

shape.ImageData.Borders[BorderType.Right].LineWidth = 2;

shape.ImageData.Borders[BorderType.Top].Color = Color.Black;

shape.ImageData.Borders[BorderType.Top].LineStyle = LineStyle.Single;

shape.ImageData.Borders[BorderType.Top].LineWidth = 2;

builder.InsertNode(shape);

doc.Save(@"out.doc");

Best regards.