Hi,
Few days ago I downloaded an evaluation version of Aspose.Word for evaluation if this product matches to our requirement, and currently I have the following problem:
I have an HTML string:
"..some other HTML tags....<img src='http://servername/images/test1.bmp' border='0' alt='test1.bmp' width='481' height='280' />follows by other HTML tags......"
then I used Inserthtml(the above string) the result is that the HTML displayed correctly except the image is a box and a letter X inside. why I cannot display the image ?
I have problem with left indent using Inserthtml, it didn’t work. I tried <blockquote>…not working as well. can you help ?
Alexey,
Thanks for your quick response, I still cannot display the image from the code you gave me, I can see the image if I put the address to the address bar directly (a car) but not with Inserthtml.
Hi
I can’t reproduce this problem on my side. Which version of Aspose.Words do you use? I use the latest version for testing and all works fine.
Best regards.
Alexey,
The problem is the <img src=.....> all over the place in the HTML string…
sString="........some HTML .......<img........some HTML again......<img.....some HTML again.......<img.......<img.......";
can be more than 1 images…
so it is not only displaying an image in the Html string, the images can be embedded inside the Html string…
My code is in VB.NET.
Thanks.
Evaluation version of Aspose.Words (without a license specified) provides full product functionality, but it injects an evaluation watermark at the top of the document on open and save and limits the maximum document size to several hundred paragraphs.
No, this feature is not implemented yet. Have you tried to use the following code to get image?
string URL = "http://images.amazon.com/images/G/03/videogames/features/TestDrive_PC_big_2.jpg";
//Create web request
WebRequest myWebRequest = WebRequest.Create(URL);
//Get response
WebResponse myWebResponse = myWebRequest.GetResponse();
//Get response stream
Stream receiveStream = myWebResponse.GetResponseStream();
//Create Image from stream and save it on local drive
Image img = Image.FromStream(receiveStream);
string localImgPath = Path.Combine(@"C:\Temp", Path.GetFileName(URL));
img.Save(localImgPath);
Really, maybe this problem occurs because proxy authentication is required.
Alexey,
The problem is I don’t know the image address, they are embedded in the html string and they can be different images in each html string (user can insert any images from any webserver in our local network).
If it is a fixed image then your code might work.
so it is hard to extract each image and save it to local.
For temporary solution I replace all occurances of src="http:/webserver/images...." to src="\\webserver\drive\images..." I have to tell users make sure all images stored in the correct image directory, otherwise it won’t display correctly.
The second problem is why leftindent didn’t work ?
i.e: (result in Word)
1.2 Header text
description…
I want to be displayed as:
1.2 header text description…
I have tried leftindent value from 1.X…to 20.X …nothing change in Word.
Thanks for your inquiry. This occurs because use InsertHtml method. Formatting of Paragraph is imported from HTML. For example if you use the following code then you will get properly formatted result.
Hi
What do you mean? Please provide sample document and your code for testing. Also note that inline style of HTML paragraph is supported, but limited to paragraph attributes exported by Aspose.Word.
Best regards.
Original htmlstring=
"<p>The modification will only impact .....</p><p>only support Batch strings up to a length of 10 characters.</p><p>will display expiry date format of DD/MM/CCYY....</p><p>Operator will be able to enter..... </p>"
then I added string from you:
"<p style='margin-left:100px;'>" + the above string + "</p>"
finally I used InsertHtml("<p style='margin-left:100px;'>" + the above string + "</p>")
I mean that
you should specify margin-left for each paragraph. For example see the
following code.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
string htmlstring = "<p>The modification will only impact .....</p><p>only support Batch strings up to a length of 10 characters.</p><p>will display expiry date format of DD/MM/CCYY....</p><p>Operator will be able to enter.....</p>";
//Insert Left Indent
htmlstring = htmlstring.Replace("<p>", "<p style='margin-left:100px;'>");
builder.InsertHtml(htmlstring);
//Save document
doc.Save(@"Test009\out.doc");