Exemplo n.º 1
0
        public override void Convert(HtmlNode node, XmlWriter writer)
        {
            foreach (var currentNode in node.ChildNodes)
            {
                // p tags are not allowed in table cells!
                if (IgnoredFields.Contains(currentNode.Name))
                {
                    // render all the children instead
                    var cellContent = new TableCellContent();
                    cellContent.Convert(currentNode, writer);
                }
                else
                {
                    IDocumentNode handler;
                    if (TableCellNodes.TryGetValue(currentNode.Name, out handler))
                    {
                        handler.Convert(currentNode, writer);
                        continue;
                    }

                    if (Nodes.TryGetValue(currentNode.Name, out handler))
                    {
                        handler.Convert(currentNode, writer);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void Convert(HtmlNode node, XmlWriter writer)
        {
            using (writer.StartElement(NlmGlobals.Output.TableCellNodeName))
            {
                writer.WriteAttributeString(NlmGlobals.Output.TableCellColSepAttributeName, Colspan.ToString());
                writer.WriteAttributeString(NlmGlobals.Output.TableCellRowSepAttributeName, Rowspan.ToString());

                if (Rowspan > 1)
                {
                    writer.WriteAttributeString("morerows", (Rowspan - 1).ToString());
                }

                if (Colspan > 1)
                {
                    writer.WriteAttributeString("namest", string.Format("col{0}", Position));
                    writer.WriteAttributeString("nameend", string.Format("col{0}", (Position - 1) + Colspan));
                }

                string chartCellClass = NlmGlobals.Output.TableCellDefaultStyleClass;
                if (IsHeader)
                {
                    chartCellClass = NlmGlobals.Output.TableCellHeaderStyleClass;
                }
                else if (IsSubHeader)
                {
                    chartCellClass = NlmGlobals.Output.TableCellSubHeaderStyleClass;
                }

                using (writer.StartElement(NlmGlobals.Output.TableCellStyledContentNodeName))
                {
                    writer.WriteAttributeString(NlmGlobals.Output.TableCellStyledContentStyleAttributeName, chartCellClass);

                    var innerContent = new TableCellContent();
                    innerContent.Convert(Node, writer);
                }
            }
        }