Ejemplo n.º 1
0
        /**********************************************************************/
        private void GetDataAndReplaceTag(HtmlTextNode tableNode)
        {
            int pos       = 0;
            int suffixPos = -1;

            while (pos < tableNode.Text.Length && pos >= 0)
            {
                pos = tableNode.Text.IndexOf(HraTagText, pos);
                if (pos >= 0)
                {
                    suffixPos = tableNode.Text.IndexOf(HraTagSuffix, pos);
                    if (pos >= 0 && suffixPos > pos)
                    {
                        string tag        = tableNode.Text.Substring(pos, suffixPos + HraTagSuffix.Length - pos);
                        string args       = tableNode.Text.Substring(pos + HraTagText.Length, suffixPos - pos - HraTagText.Length);
                        int    templateId = -1;
                        int.TryParse(args, out templateId);

                        string value = "";

                        if (templateId > 0)
                        {
                            DocumentTemplate dt = new DocumentTemplate();
                            dt.documentTemplateID = templateId;
                            dt.SetPatient(proband);
                            dt.BackgroundLoadWork();
                            dt.OpenHTML();
                            dt.UseDocArgs = UseDocArgs;
                            dt.ProcessDocument();
                            value = dt.htmlText;
                            HtmlNode body = dt.FindNodeByName(dt.doc.DocumentNode, "body");
                            StripNonInsertNodes(body);
                            if (body != null)
                            {
                                value = body.InnerHtml;
                            }

                            tableNode.Text = tableNode.Text.Replace(tag, value);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /**********************************************************************/
        private void GetDataAndReplaceTag(HtmlTextNode tableNode)
        {
            int pos = 0;
            int suffixPos = -1;

            while (pos < tableNode.Text.Length && pos >= 0)
            {
                pos = tableNode.Text.IndexOf(HraTagText, pos);
                if (pos >= 0)
                {
                    suffixPos = tableNode.Text.IndexOf(HraTagSuffix, pos);
                    if (pos >= 0 && suffixPos > pos)
                    {
                        string tag = tableNode.Text.Substring(pos, suffixPos + HraTagSuffix.Length - pos);
                        string args = tableNode.Text.Substring(pos + HraTagText.Length, suffixPos - pos - HraTagText.Length);
                        int templateId = -1;
                        int.TryParse(args, out templateId);

                        string value = "";

                        if (templateId > 0)
                        {
                            DocumentTemplate dt = new DocumentTemplate();
                            dt.documentTemplateID = templateId;
                            dt.SetPatient(proband);
                            dt.BackgroundLoadWork();
                            dt.OpenHTML();
                            dt.UseDocArgs = UseDocArgs;
                            dt.ProcessDocument();
                            value = dt.htmlText;
                            HtmlNode body = dt.FindNodeByName(dt.doc.DocumentNode, "body");
                            StripNonInsertNodes(body);
                            if (body != null)
                            {
                                value = body.InnerHtml;
                            }

                            tableNode.Text = tableNode.Text.Replace(tag, value);
                        }
                    }
                }
            }
        }