This project has moved and is read-only. For the latest updates, please go here.

converter parse img returns nothing

Feb 24, 2014 at 3:21 PM
Edited Feb 24, 2014 at 3:21 PM
this is my code:

Document document = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
            MainPart.Document = document;

            Body body = new Body();
            HtmlConverter converter = new HtmlConverter(MainPart);
            //converter.ImageProcessing = ImageProcessing.ManualProvisioning;
            //converter.ProvisionImage += converter_ProvisionImage;
            foreach (ParagraphObject paragraphObject in paragraphs)
                var htmlParagraphs = converter.Parse(paragraphObject.TitleAfterParsing);
                foreach (Paragraph paragraph in htmlParagraphs)
                    body.Append(GenerateCustomParagraph(paragraphObject, paragraph, true));

                switch (paragraphObject.Type)
                    case ParagraphObject.ParagraphType.Text:
                        htmlParagraphs = converter.Parse(paragraphObject.ContentAfterParsing);
                        for (int i = 0; i < htmlParagraphs.Count; i++)
when i parse html tag img with a src being an valid url it return no htmlParagraps
i use htmlTOopenXML 1.4.1
Feb 24, 2014 at 3:43 PM
Can you show me what's in "paragraphObject" ?
In fact, what is the HTML you are parsing?
Feb 24, 2014 at 4:12 PM
Edited Feb 24, 2014 at 4:12 PM
simply <img alt="" src="http://localhost/Piktogramy/C.png" />
Feb 24, 2014 at 5:32 PM
Don't you need a proxy or credentials? You can still download the source code and debug from there.
Feb 25, 2014 at 9:12 AM
Ok tried a different solution, becouse it turns out when i use a external web url it works fine. I decided to try with this solution:
private void converter_ProvisionImage(object sender, ProvisionImageEventArgs e)
   // Read the image from the file system:
    e.Data = File.ReadAllBytes(@"c:\inetpub\wwwroot\mysite\images\" + e.ImageUrl);
but even thoudh the e.Data fills with correct byte array the converter does not generate nothing.
Mar 4, 2014 at 12:00 PM
Hi drabiu,

I have just committed a fix for local file.
Thanks to daviderapicavoli which has submitted the patch

Hope that fix your bug