Exemplo n.º 1
0
        internal List<customSection> getHTML(string text, List<customSection> sections = null)
        {
            if (sections == null) sections = new List<customSection>();
            NotesFor.HtmlToOpenXml.HtmlConverter htmlconv = new NotesFor.HtmlToOpenXml.HtmlConverter(mainDoc);
            int start = text.ToString().IndexOf("{IMG");

            if (start > 0)
            {
                //There's an image.  Start by adding the text before the image

                sections.Add(new customSection(htmlconv.Parse(text.Substring(0, start))));
                //Add the image
                string part = text.Substring(start);
                int end = part.IndexOf('}');
                imageObj image = new imageObj();
                string imagestring = part.Substring(5, end - 5); //gives "#:title" inside the {}
                image.Url = "http://mbastorage.blob.core.windows.net/sfwart/" + new ARTService().ImageGet(m_ReportId, Convert.ToInt32(imagestring.Split(':')[0])).Path.Replace(" ", "%20");
                image.Link = image.Url;
                image.Filename = image.Url;
                sections.Add(new customSection(image));

                //Now recursively pass the remaining xml to this function again (in case there are additional images to process)
                sections = getHTML(text.Substring(start + end+ 1), sections);
            }
            else
            {
                sections.Add(new customSection(htmlconv.Parse(text)));
            }
            return sections;
        }
Exemplo n.º 2
0
 public customSection(imageObj image)
 {
     this.Image = image;
 }