Procházet zdrojové kódy

Applied patch 11607 submitted by arudoy which solves the problem described in 10453.

Thank you for your contribution arudoy.
master
coffeycathal_cp před 13 roky
rodič
revize
fb7b2b7cdf
1 změnil soubory, kde provedl 34 přidání a 3 odebrání
  1. 34
    3
      DocX/Table.cs

+ 34
- 3
DocX/Table.cs Zobrazit soubor

@@ -173,9 +173,7 @@ namespace Novacode
{
if (RowCount == 0)
return 0;
return Xml.Elements(XName.Get("tr", DocX.w.NamespaceName)) // select rows
.First() // get first row
.Elements(XName.Get("tc", DocX.w.NamespaceName)).Count(); // return column count from first row
return Rows.First().ColumnCount;
}
}
@@ -1614,6 +1612,39 @@ namespace Novacode
/// </summary>
public class Row : Container
{
/// <summary>
/// Calculates columns count in the row, taking spanned cells into account
/// </summary>
public Int32 ColumnCount
{
get
{
int gridSpanSum = 0;
// Foreach each Cell between startIndex and endIndex inclusive.
foreach (Cell c in Cells)
{
XElement tcPr = c.Xml.Element(XName.Get("tcPr", DocX.w.NamespaceName));
if (tcPr != null)
{
XElement gridSpan = tcPr.Element(XName.Get("gridSpan", DocX.w.NamespaceName));
if (gridSpan != null)
{
XAttribute val = gridSpan.Attribute(XName.Get("val", DocX.w.NamespaceName));
int value = 0;
if (val != null)
if (int.TryParse(val.Value, out value))
gridSpanSum += value - 1;
}
}
}
// return cells count + count of spanned cells
return Cells.Count + gridSpanSum;
}
}
/// <summary>
/// A list of Cells in this Row.
/// </summary>

Načítá se…
Zrušit
Uložit