Пример #1
0
 public static TableAttributes mtableAttributes(Node node)
 {
     Nodes.Attribute attribute = null;
     TableAttributes tableAttributes = null;
     try
     {
         if (node.attrs == null)
         {
             return tableAttributes;
         }
         node.attrs.Reset();
         for (attribute = node.attrs.Next(); attribute != null; attribute = node.attrs.Next())
         {
             string s = attribute.val.Trim();
             if (attribute.name == "align")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     if (s.ToUpper() == "TOP")
                     {
                         tableAttributes.align = TableAlign.TOP;
                     }
                     else if (s.ToUpper() == "BOTTOM")
                     {
                         tableAttributes.align = TableAlign.BOTTOM;
                     }
                     else if (s.ToUpper() == "CENTER")
                     {
                         tableAttributes.align = TableAlign.CENTER;
                     }
                     else if (s.ToUpper() == "BASELINE")
                     {
                         tableAttributes.align = TableAlign.BASELINE;
                     }
                     else if (s.ToUpper() == "AXIS")
                     {
                         tableAttributes.align = TableAlign.AXIS;
                     }
                     else
                     {
                         tableAttributes.align = TableAlign.AXIS;
                     }
                 }
             }
             else if (attribute.name == "side")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     if (s.ToUpper() == "LEFT")
                     {
                         tableAttributes.side = Side.LEFT;
                     }
                     else if (s.ToUpper() == "RIGHT")
                     {
                         tableAttributes.side = Side.RIGHT;
                     }
                     else if (s.ToUpper() == "LEFTOVERLAP")
                     {
                         tableAttributes.side = Side.LEFTOVERLAP;
                     }
                     else if (s.ToUpper() == "RIGHTOVERLAP")
                     {
                         tableAttributes.side = Side.RIGHTOVERLAP;
                     }
                 }
             }
             else if (attribute.name == "minlabelspacing")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     tableAttributes.minlabelspacing = s.Trim();
                 }
             }
             else if (attribute.name == "rowalign")
             {
                 if (s.Length > 0)
                 {
                     s = s.Trim();
                     string[] strings = s.Split(new char[] { ' ' }, 100);
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     int numAligns = 0;
                     for (int i = 0; i < strings.Length; i++)
                     {
                         if (((strings[i].ToUpper() == "TOP") || (strings[i].ToUpper() == "BOTTOM")) || (((strings[i].ToUpper() == "CENTER") || (strings[i].ToUpper() == "BASELINE")) || (strings[i].ToUpper() == "AXIS")))
                         {
                             numAligns++;
                         }
                     }
                     tableAttributes.rowAligns = new RowAlign[numAligns];
                     if (numAligns > 0)
                     {
                         for (int i = 0; i < strings.Length; i++)
                         {
                             if (strings[i].ToUpper() == "TOP")
                             {
                                 tableAttributes.rowAligns[i] = RowAlign.TOP;
                             }
                             else if (strings[i].ToUpper() == "BOTTOM")
                             {
                                 tableAttributes.rowAligns[i] = RowAlign.BOTTOM;
                             }
                             else if (strings[i].ToUpper() == "CENTER")
                             {
                                 tableAttributes.rowAligns[i] = RowAlign.CENTER;
                             }
                             else if (strings[i].ToUpper() == "BASELINE")
                             {
                                 tableAttributes.rowAligns[i] = RowAlign.BASELINE;
                             }
                             else if (strings[i].ToUpper() == "AXIS")
                             {
                                 tableAttributes.rowAligns[i] = RowAlign.AXIS;
                             }
                         }
                     }
                     else
                     {
                         tableAttributes.rowAligns = new RowAlign[] { RowAlign.BASELINE };
                     }
                 }
             }
             else if (attribute.name == "columnalign")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     s = s.Trim();
                     string[] strings = s.Split(new char[] { ' ' }, 100);
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     int numAligns = 0;
                     for (int i = 0; i < strings.Length; i++)
                     {
                         if (((strings[i].ToUpper() == "LEFT") || (strings[i].ToUpper() == "CENTER")) || (strings[i].ToUpper() == "RIGHT"))
                         {
                             numAligns++;
                         }
                     }
                     tableAttributes.colAligns = new HAlign[numAligns];
                     if (numAligns > 0)
                     {
                         for (int i = 0; i < strings.Length; i++)
                         {
                             if (strings[i].ToUpper() == "LEFT")
                             {
                                 tableAttributes.colAligns[i] = HAlign.LEFT;
                             }
                             else if (strings[i].ToUpper() == "CENTER")
                             {
                                 tableAttributes.colAligns[i] = HAlign.CENTER;
                             }
                             else if (strings[i].ToUpper() == "RIGHT")
                             {
                                 tableAttributes.colAligns[i] = HAlign.RIGHT;
                             }
                         }
                     }
                     else
                     {
                         tableAttributes.colAligns = new HAlign[] { HAlign.CENTER };
                     }
                 }
             }
             else if (attribute.name == "frame")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     if (s.ToUpper() == "SOLID")
                     {
                         tableAttributes.frame = TableLineStyle.SOLID;
                     }
                     else if (s.ToUpper() == "DASHED")
                     {
                         tableAttributes.frame = TableLineStyle.DASHED;
                     }
                     else
                     {
                         tableAttributes.frame = TableLineStyle.NONE;
                     }
                 }
             }
             else if (attribute.name == "framespacing")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     tableAttributes.framespacing = s;
                 }
             }
             else if (attribute.name == "rowspacing")
             {
                 if (s.Length > 0)
                 {
                     s = s.Trim();
                     string[] strings = s.Split(new char[] { ' ' }, 100);
                     if (strings.Length > 0)
                     {
                         if (tableAttributes == null)
                         {
                             tableAttributes = new TableAttributes();
                         }
                         tableAttributes.rowSpacing = new string[strings.Length];
                         for (int i = 0; i < strings.Length; i++)
                         {
                             tableAttributes.rowSpacing[i] = strings[i];
                         }
                     }
                 }
             }
             else if (attribute.name == "columnspacing")
             {
                 if (s.Length > 0)
                 {
                     s = s.Trim();
                     string[] strings = s.Split(new char[] { ' ' }, 100);
                     if (strings.Length > 0)
                     {
                         if (tableAttributes == null)
                         {
                             tableAttributes = new TableAttributes();
                         }
                         tableAttributes.colSpacing = new string[strings.Length];
                         for (int i = 0; i < strings.Length; i++)
                         {
                             tableAttributes.colSpacing[i] = strings[i];
                         }
                     }
                 }
             }
             else if (attribute.name == "rowlines")
             {
                 if (s.Length > 0)
                 {
                     s = s.Trim();
                     string[] strings = s.Split(new char[] { ' ' }, 100);
                     int numLines = 0;
                     if (strings.Length > 0)
                     {
                         for (int i = 0; i < strings.Length; i++)
                         {
                             if (((strings[i].ToUpper() == "NONE") || (strings[i].ToUpper() == "SOLID")) || (strings[i].ToUpper() == "DASHED"))
                             {
                                 numLines++;
                             }
                         }
                     }
                     if (numLines > 0)
                     {
                         if (tableAttributes == null)
                         {
                             tableAttributes = new TableAttributes();
                         }
                         tableAttributes.rowLines = new TableLineStyle[numLines];
                         int lineIndex = 0;
                         for (int i = 0; i < strings.Length; i++)
                         {
                             if (((strings[i].ToUpper() == "NONE") || (strings[i].ToUpper() == "SOLID")) || (strings[i].ToUpper() == "DASHED"))
                             {
                                 if (strings[i].ToUpper() == "SOLID")
                                 {
                                     tableAttributes.rowLines[lineIndex] = TableLineStyle.SOLID;
                                     lineIndex++;
                                 }
                                 else if (strings[i].ToUpper() == "DASHED")
                                 {
                                     tableAttributes.rowLines[lineIndex] = TableLineStyle.DASHED;
                                     lineIndex++;
                                 }
                                 else if (strings[i].ToUpper() == "NONE")
                                 {
                                     tableAttributes.rowLines[lineIndex] = TableLineStyle.NONE;
                                     lineIndex++;
                                 }
                             }
                         }
                     }
                 }
             }
             else if (attribute.name == "columnlines")
             {
                 if (s.Length > 0)
                 {
                     s = s.Trim();
                     string[] strings = s.Split(new char[] { ' ' }, 100);
                     int numLines = 0;
                     if (strings.Length > 0)
                     {
                         for (int i = 0; i < strings.Length; i++)
                         {
                             if (((strings[i].ToUpper() == "NONE") || (strings[i].ToUpper() == "SOLID")) || (strings[i].ToUpper() == "DASHED"))
                             {
                                 numLines++;
                             }
                         }
                     }
                     if (numLines > 0)
                     {
                         if (tableAttributes == null)
                         {
                             tableAttributes = new TableAttributes();
                         }
                         tableAttributes.colLines = new TableLineStyle[numLines];
                         int lineIndex = 0;
                         for (int i = 0; i < strings.Length; i++)
                         {
                             if (((strings[i].ToUpper() == "NONE") || (strings[i].ToUpper() == "SOLID")) || (strings[i].ToUpper() == "DASHED"))
                             {
                                 if (strings[i].ToUpper() == "SOLID")
                                 {
                                     tableAttributes.colLines[lineIndex] = TableLineStyle.SOLID;
                                     lineIndex++;
                                 }
                                 else if (strings[i].ToUpper() == "DASHED")
                                 {
                                     tableAttributes.colLines[lineIndex] = TableLineStyle.DASHED;
                                     lineIndex++;
                                 }
                                 else if (strings[i].ToUpper() == "NONE")
                                 {
                                     tableAttributes.colLines[lineIndex] = TableLineStyle.NONE;
                                     lineIndex++;
                                 }
                             }
                         }
                     }
                 }
             }
             else if (attribute.name == "equalrows")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     tableAttributes.equalRows = Convert.ToBoolean(s);
                 }
             }
             else if (attribute.name == "equalcolumns")
             {
                 if (s.Length > 0)
                 {
                     if (tableAttributes == null)
                     {
                         tableAttributes = new TableAttributes();
                     }
                     tableAttributes.equalColumns = Convert.ToBoolean(s);
                 }
             }
             else if ((attribute.name == "displaystyle") && (s.Length > 0))
             {
                 if (tableAttributes == null)
                 {
                     tableAttributes = new TableAttributes();
                 }
                 tableAttributes.displaystyle = Convert.ToBoolean(s);
             }
         }
         node.attrs.Reset();
     }
     catch
     {
     }
     return tableAttributes;
 }
Пример #2
0
 public static void ApplyAttrs(Node node, TableAttributes tableAttributes)
 {
     if (((node != null) && (node.type_ != null)) && ((node.type_.type == ElementType.Mtable) && (tableAttributes != null)))
     {
         if (tableAttributes.align == TableAlign.TOP)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("align", "top");
         }
         else if (tableAttributes.align == TableAlign.BOTTOM)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("align", "bottom");
         }
         else if (tableAttributes.align == TableAlign.CENTER)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("align", "center");
         }
         else if (tableAttributes.align == TableAlign.BASELINE)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("align", "baseline");
         }
         else if ((tableAttributes.align == TableAlign.AXIS) && (node.attrs != null))
         {
             Nodes.Attribute attribute = node.attrs.Get("align");
             if (attribute != null)
             {
                 node.attrs.Remove(attribute);
             }
         }
         if (tableAttributes.side == Side.LEFT)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("side", "left");
         }
         else if (tableAttributes.side == Side.LEFTOVERLAP)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("side", "leftoverlap");
         }
         else if (tableAttributes.side == Side.RIGHTOVERLAP)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("side", "rightoverlap");
         }
         else if (node.attrs != null)
         {
             Nodes.Attribute attribute = node.attrs.Get("side");
             if (attribute != null)
             {
                 node.attrs.Remove(attribute);
             }
         }
         string s = "";
         for (int i = 0; i < tableAttributes.rowAligns.Length; i++)
         {
             if (tableAttributes.rowAligns[i] == RowAlign.TOP)
             {
                 if (i > 0)
                 {
                     s = s + " ";
                 }
                 s = s + "top";
             }
             else if (tableAttributes.rowAligns[i] == RowAlign.BOTTOM)
             {
                 if (i > 0)
                 {
                     s = s + " ";
                 }
                 s = s + "bottom";
             }
             else if (tableAttributes.rowAligns[i] == RowAlign.CENTER)
             {
                 if (i > 0)
                 {
                     s = s + " ";
                 }
                 s = s + "center";
             }
             else if (tableAttributes.rowAligns[i] == RowAlign.AXIS)
             {
                 if (i > 0)
                 {
                     s = s + " ";
                 }
                 s = s + "axis";
             }
             else if (tableAttributes.rowAligns[i] == RowAlign.BASELINE)
             {
                 if (i > 0)
                 {
                     s = s + " ";
                 }
                 s = s + "baseline";
             }
         }
         if ((tableAttributes.rowAligns.Length == 1) && (s.Trim() == "baseline"))
         {
             if (node.attrs != null)
             {
                 Nodes.Attribute attribute = node.attrs.Get("rowalign");
                 if (attribute != null)
                 {
                     node.attrs.Remove(attribute);
                 }
             }
         }
         else
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             if (s.Length > 0)
             {
                 node.attrs.Add("rowalign", s);
             }
         }
         string sAlign = "";
         for (int i = 0; i < tableAttributes.colAligns.Length; i++)
         {
             if (tableAttributes.colAligns[i] == HAlign.LEFT)
             {
                 if (i > 0)
                 {
                     sAlign = sAlign + " ";
                 }
                 sAlign = sAlign + "left";
             }
             else if (tableAttributes.colAligns[i] == HAlign.CENTER)
             {
                 if (i > 0)
                 {
                     sAlign = sAlign + " ";
                 }
                 sAlign = sAlign + "center";
             }
             else if (tableAttributes.colAligns[i] == HAlign.RIGHT)
             {
                 if (i > 0)
                 {
                     sAlign = sAlign + " ";
                 }
                 sAlign = sAlign + "right";
             }
         }
         if ((tableAttributes.colAligns.Length == 1) && (sAlign.Trim() == "center"))
         {
             if (node.attrs != null)
             {
                 Nodes.Attribute attribute = node.attrs.Get("columnalign");
                 if (attribute != null)
                 {
                     node.attrs.Remove(attribute);
                 }
             }
         }
         else
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             if (sAlign.Length > 0)
             {
                 node.attrs.Add("columnalign", sAlign);
             }
         }
         if (tableAttributes.equalRows)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("equalrows", "True");
         }
         else if (!tableAttributes.equalRows && (node.attrs != null))
         {
             Nodes.Attribute attribute = node.attrs.Get("equalrows");
             if (attribute != null)
             {
                 node.attrs.Remove(attribute);
             }
         }
         if (tableAttributes.equalColumns)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("equalcolumns", "True");
         }
         else if (!tableAttributes.equalColumns && (node.attrs != null))
         {
             Nodes.Attribute attribute = node.attrs.Get("equalcolumns");
             if (attribute != null)
             {
                 node.attrs.Remove(attribute);
             }
         }
         if (tableAttributes.displaystyle)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("displaystyle", "True");
         }
         else if (!tableAttributes.displaystyle && (node.attrs != null))
         {
             Nodes.Attribute attribute = node.attrs.Get("displaystyle");
             if (attribute != null)
             {
                 node.attrs.Remove(attribute);
             }
         }
         if (tableAttributes.framespacing != "0.4em 0.5ex")
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("framespacing", tableAttributes.framespacing);
         }
         else if ((tableAttributes.framespacing == "0.4em 0.5ex") && (node.attrs != null))
         {
             Nodes.Attribute attribute = node.attrs.Get("framespacing");
             if (attribute != null)
             {
                 node.attrs.Remove(attribute);
             }
         }
         if ((tableAttributes.rowSpacing.Length == 1) && (tableAttributes.rowSpacing[0] == "0.5ex"))
         {
             if (node.attrs != null)
             {
                 Nodes.Attribute attribute = node.attrs.Get("rowspacing");
                 if (attribute != null)
                 {
                     node.attrs.Remove(attribute);
                 }
             }
         }
         else
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             string ss = "";
             for (int i = 0; i < tableAttributes.rowSpacing.Length; i++)
             {
                 if (i > 0)
                 {
                     ss = ss + " ";
                 }
                 ss = ss + tableAttributes.rowSpacing[i];
             }
             if (ss.Length > 0)
             {
                 node.attrs.Add("rowspacing", ss);
             }
         }
         if ((tableAttributes.colSpacing.Length == 1) && (tableAttributes.colSpacing[0] == "0.8em"))
         {
             if (node.attrs != null)
             {
                 Nodes.Attribute attribute = node.attrs.Get("columnspacing");
                 if (attribute != null)
                 {
                     node.attrs.Remove(attribute);
                 }
             }
         }
         else
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             string ss = "";
             for (int i = 0; i < tableAttributes.colSpacing.Length; i++)
             {
                 if (i > 0)
                 {
                     ss = ss + " ";
                 }
                 ss = ss + tableAttributes.colSpacing[i];
             }
             if (ss.Length > 0)
             {
                 node.attrs.Add("columnspacing", ss);
             }
         }
         if (tableAttributes.frame == TableLineStyle.DASHED)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("frame", "dashed");
         }
         if (tableAttributes.frame == TableLineStyle.SOLID)
         {
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             node.attrs.Add("frame", "solid");
         }
         if ((tableAttributes.frame == TableLineStyle.NONE) && (node.attrs != null))
         {
             Nodes.Attribute attribute = node.attrs.Get("frame");
             if (attribute != null)
             {
                 node.attrs.Remove(attribute);
             }
         }
         if ((tableAttributes.rowLines.Length == 1) && (tableAttributes.rowLines[0] == TableLineStyle.NONE))
         {
             if (node.attrs != null)
             {
                 Nodes.Attribute attribute = node.attrs.Get("rowlines");
                 if (attribute != null)
                 {
                     node.attrs.Remove(attribute);
                 }
             }
         }
         else
         {
             string ss = "";
             for (int i = 0; i < tableAttributes.rowLines.Length; i++)
             {
                 if (tableAttributes.rowLines[i] == TableLineStyle.DASHED)
                 {
                     if (i > 0)
                     {
                         ss = ss + " ";
                     }
                     ss = ss + "dashed";
                 }
                 else if (tableAttributes.rowLines[i] == TableLineStyle.SOLID)
                 {
                     if (i > 0)
                     {
                         ss = ss + " ";
                     }
                     ss = ss + "solid";
                 }
                 else if (tableAttributes.rowLines[i] == TableLineStyle.NONE)
                 {
                     if (i > 0)
                     {
                         ss = ss + " ";
                     }
                     ss = ss + "none";
                 }
             }
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             if (ss.Length > 0)
             {
                 node.attrs.Add("rowlines", ss);
             }
         }
         if ((tableAttributes.colLines.Length == 1) && (tableAttributes.colLines[0] == TableLineStyle.NONE))
         {
             if (node.attrs == null)
             {
                 return;
             }
             Nodes.Attribute attribute = node.attrs.Get("columnlines");
             if (attribute == null)
             {
                 return;
             }
             node.attrs.Remove(attribute);
         }
         else
         {
             string ss = "";
             for (int i = 0; i < tableAttributes.colLines.Length; i++)
             {
                 if (tableAttributes.colLines[i] == TableLineStyle.DASHED)
                 {
                     if (i > 0)
                     {
                         ss = ss + " ";
                     }
                     ss = ss + "dashed";
                 }
                 else if (tableAttributes.colLines[i] == TableLineStyle.SOLID)
                 {
                     if (i > 0)
                     {
                         ss = ss + " ";
                     }
                     ss = ss + "solid";
                 }
                 else if (tableAttributes.colLines[i] == TableLineStyle.NONE)
                 {
                     if (i > 0)
                     {
                         ss = ss + " ";
                     }
                     ss = ss + "none";
                 }
             }
             if (node.attrs == null)
             {
                 node.attrs = new AttributeList();
             }
             if (ss.Length > 0)
             {
                 node.attrs.Add("columnlines", ss);
             }
         }
     }
 }
Пример #3
0
 public void ApplyAttrs()
 {
     try
     {
         TableAttributes attrs;
         this.ColAligns();
         this.RowAligns();
         if (this.attrs != null)
         {
             attrs = this.attrs;
         }
         else
         {
             attrs = new TableAttributes();
         }
         attrs.colAligns = this.colAligns;
         attrs.rowAligns = this.rowAligns;
         attrs.rowSpacing = new string[this.rows.Count];
         attrs.rowLines = new TableLineStyle[this.rows.Count];
         attrs.colSpacing = this.colSpacing;
         attrs.colLines = this.colLines;
         attrs.displaystyle = this.displayStyle;
         attrs.equalColumns = this.equalColumns;
         attrs.equalRows = this.equalRows;
         attrs.align = this.align;
         attrs.frame = this.frame;
         attrs.framespacing = this.framespacing;
         attrs.side = this.side;
         attrs.minlabelspacing = this.minlabelSpacing;
         bool sameStyle = true;
         TableLineStyle lineStyle = TableLineStyle.NONE;
         for (int i = 0; i < attrs.colLines.Length; i++)
         {
             if ((i > 0) && (attrs.colLines[i] != lineStyle))
             {
                 sameStyle = false;
             }
             lineStyle = attrs.colLines[i];
         }
         if (sameStyle)
         {
             attrs.colLines = new TableLineStyle[] { lineStyle };
         }
         bool sameColSpacing = true;
         string colSpacing = "0.8em";
         for (int i = 0; i < attrs.colSpacing.Length; i++)
         {
             if ((i > 0) && (attrs.colSpacing[i] != colSpacing))
             {
                 sameColSpacing = false;
             }
             colSpacing = attrs.colSpacing[i];
         }
         if (sameColSpacing)
         {
             attrs.colSpacing = new string[] { colSpacing };
         }
         for (int i = 0; i < this.rows.Count; i++)
         {
             MRow row = this.GetRow(i);
             attrs.rowSpacing[i] = row.spacing;
             attrs.rowLines[i] = row.lines;
             Node node = row.node;
             TableRowAttributes rowAttributes = row.attrs;
             if (rowAttributes != null)
             {
                 rowAttributes.colAligns = row.colAligns;
                 rowAttributes.align = row.align;
                 AttributeBuilder.ApplyAttributes(node, rowAttributes);
             }
             else
             {
                 rowAttributes = new TableRowAttributes();
                 rowAttributes.colAligns = row.colAligns;
                 rowAttributes.align = row.align;
                 AttributeBuilder.ApplyAttributes(node, rowAttributes);
             }
             if ((row.isLabeled && (row.cell != null)) && (row.cell.node != null))
             {
                 TableCellAttributes cellAttributes = row.cell.tableAttrs;
                 Node n = row.cell.node;
                 if (cellAttributes != null)
                 {
                     cellAttributes.columnAlign = row.cell.columnAlign;
                     cellAttributes.rowAlign = row.cell.rowAlign;
                     AttributeBuilder.ApplyAttrs(n, cellAttributes);
                 }
                 else
                 {
                     cellAttributes = new TableCellAttributes();
                     cellAttributes.columnAlign = row.cell.columnAlign;
                     cellAttributes.rowAlign = row.cell.rowAlign;
                     AttributeBuilder.ApplyAttrs(n, cellAttributes);
                 }
             }
             for (int j = 0; j < ((MRow) this.rows[i]).cells.Count; j++)
             {
                 Node n = ((MCell) ((MRow) this.rows[i]).cells[j]).node;
                 TableCellAttributes cellAttributes = ((MCell) ((MRow) this.rows[i]).cells[j]).tableAttrs;
                 RowAlign rowAlign = ((MCell) ((MRow) this.rows[i]).cells[j]).rowAlign;
                 if (cellAttributes != null)
                 {
                     cellAttributes.columnAlign = ((MCell) ((MRow) this.rows[i]).cells[j]).columnAlign;
                     cellAttributes.rowAlign = ((MCell) ((MRow) this.rows[i]).cells[j]).rowAlign;
                     AttributeBuilder.ApplyAttrs(n, cellAttributes);
                 }
                 else
                 {
                     cellAttributes = new TableCellAttributes();
                     cellAttributes.columnAlign = ((MCell) ((MRow) this.rows[i]).cells[j]).columnAlign;
                     cellAttributes.rowAlign = ((MCell) ((MRow) this.rows[i]).cells[j]).rowAlign;
                     AttributeBuilder.ApplyAttrs(n, cellAttributes);
                 }
             }
         }
         bool sameRowL = true;
         TableLineStyle tableLineStyle = TableLineStyle.NONE;
         for (int i = 0; i < attrs.rowLines.Length; i++)
         {
             if ((i > 0) && (attrs.rowLines[i] != tableLineStyle))
             {
                 sameRowL = false;
             }
             tableLineStyle = attrs.rowLines[i];
         }
         if (sameRowL)
         {
             attrs.rowLines = new TableLineStyle[] { tableLineStyle };
         }
         bool sameRowS = true;
         string rowSpacing = "0.5ex";
         for (int i = 0; i < attrs.rowSpacing.Length; i++)
         {
             if ((i > 0) && (attrs.rowSpacing[i] != rowSpacing))
             {
                 sameRowS = false;
             }
             rowSpacing = attrs.rowSpacing[i];
         }
         if (sameRowS)
         {
             attrs.rowSpacing = new string[] { rowSpacing };
         }
         AttributeBuilder.ApplyAttrs(this.node_, attrs);
     }
     catch
     {
     }
 }