Alsing.SourceCode.SyntaxDocumentExporters.CollapsingHTMLExporter.Export C# (CSharp) Method

Export() public method

Exports the content of a SyntaxDocument to a HTML formatted string
public Export ( SyntaxDocument doc, Color BGColor, string ImagePath, string Style ) : string
doc SyntaxDocument SyntaxDocument object to export from
BGColor Color HTML color string to use as background color
ImagePath string File path tho the images to use in the HTML string
Style string HTML style string that should be applied to the output
return string
        public string Export(SyntaxDocument doc, Color BGColor,
                             string ImagePath, string Style)
        {
            sb = new StringBuilder();
            doc.ParseAll(true);
            int i = 0;

            string guid = DateTime.Now.Ticks.ToString
                (CultureInfo.InvariantCulture);

            //style=\"font-family:courier new;font-size:13px;\"
            if (BGColor.A == 0)
                Out("<table  ><tr><td nowrap><div style=\"" + Style + "\">");
            else
                Out("<table  style=\"background-color:" + GetHTMLColor(BGColor) + ";" +
                    Style + "\"><tr><td nowrap><div>");
            foreach (Row r in doc)
            {
                i++;
                if (r.CanFold)
                {
                    RenderCollapsed(r.VirtualCollapsedRow, r, i, ImagePath, guid);
                    Out("<div style=\"display:block;\" id=\"open" + guid + "_" +
                        i.ToString(CultureInfo.InvariantCulture) +
                        "\">");

                    string img = "minus.gif";
                    try
                    {
                        if (r.expansion_StartSpan.Parent.Parent == null)
                            img = "minusNoTopLine.gif";
                    }
                    catch {}
                    Out("<img src=\"" + ImagePath + img + "\" align=top onclick=\"open" +
                        guid + "_" + i.ToString
                                         (CultureInfo.InvariantCulture) +
                        ".style.display='none'; closed" + guid + "_" + i.ToString
                                                                           (CultureInfo.InvariantCulture) +
                        ".style.display='block'; \">");
                }
                else
                {
                    if (r.CanFoldEndPart)
                    {
                        Out("<img src=\"" + ImagePath + "L.gif\"  align=top>");
                    }
                    else
                    {
                        if (r.HasExpansionLine)
                        {
                            Out("<img src=\"" + ImagePath + "I.gif\"  align=top>");
                        }
                        else
                        {
                            Out("<img src=\"" + ImagePath + "clear.gif\"  align=top>");
                        }
                    }
                }
                foreach (Word w in r)
                {
                    write(w.Text, w.Style);
                }
                if (r.CanFoldEndPart)
                    Out("</div>\n");
                else
                    Out("<br>\n");
            }
            Out("</div></td></tr></table>");

            return sb.ToString();
        }

Same methods

CollapsingHTMLExporter::Export ( SyntaxDocument doc, string ImagePath ) : string