coffeycathal_cp pirms 15 gadiem
vecāks
revīzija
55449423ce
1 mainītis faili ar 38 papildinājumiem un 7 dzēšanām
  1. 38
    7
      DocX/Table.cs

+ 38
- 7
DocX/Table.cs Parādīt failu

public List<Row> Rows { get { return rows; } } public List<Row> Rows { get { return rows; } }
private TableDesign design; private TableDesign design;
internal PackagePart mainPart;
internal Table(DocX document, XElement xml):base(document, xml) internal Table(DocX document, XElement xml):base(document, xml)
{ {
autofit = AutoFit.ColoumnWidth; autofit = AutoFit.ColoumnWidth;
XElement properties = xml.Element(XName.Get("tblPr", DocX.w.NamespaceName)); XElement properties = xml.Element(XName.Get("tblPr", DocX.w.NamespaceName));
rows = (from r in xml.Elements(XName.Get("tr", DocX.w.NamespaceName)) rows = (from r in xml.Elements(XName.Get("tr", DocX.w.NamespaceName))
select new Row(document, r)).ToList();
select new Row(this, document, r)).ToList();
rowCount = rows.Count; rowCount = rows.Count;
content.Add(new XElement(XName.Get("tc", DocX.w.NamespaceName), new XElement(XName.Get("p", DocX.w.NamespaceName)))); content.Add(new XElement(XName.Get("tc", DocX.w.NamespaceName), new XElement(XName.Get("p", DocX.w.NamespaceName))));
XElement e = new XElement(XName.Get("tr", DocX.w.NamespaceName), content); XElement e = new XElement(XName.Get("tr", DocX.w.NamespaceName), content);
Row newRow = new Row(Document, e);
Row newRow = new Row(this, Document, e);
XElement rowXml; XElement rowXml;
if (index == rows.Count) if (index == rows.Count)
} }
rows = (from r in Xml.Elements(XName.Get("tr", DocX.w.NamespaceName)) rows = (from r in Xml.Elements(XName.Get("tr", DocX.w.NamespaceName))
select new Row(Document, r)).ToList();
select new Row(this, Document, r)).ToList();
rowCount = rows.Count; rowCount = rows.Count;
List<Cell> cells = List<Cell> cells =
( (
from c in Xml.Elements(XName.Get("tc", DocX.w.NamespaceName)) from c in Xml.Elements(XName.Get("tc", DocX.w.NamespaceName))
select new Cell(Document, c)
select new Cell(this, Document, c)
).ToList(); ).ToList();
return cells; return cells;
} }
} }
internal Row(DocX document, XElement xml):base(document, xml)
public override List<Paragraph> Paragraphs
{
get
{
List<Paragraph> paragraphs = base.Paragraphs;
foreach (Paragraph p in paragraphs)
p.PackagePart = table.mainPart;
return paragraphs;
}
}
internal Table table;
internal Row(Table table, DocX document, XElement xml):base(document, xml)
{ {
this.table = table;
} }
/// <summary> /// <summary>
public class Cell:Container public class Cell:Container
{ {
internal Cell(DocX document, XElement xml):base(document, xml)
internal Row row;
internal Cell(Row row, DocX document, XElement xml):base(document, xml)
{ {
this.row = row;
}
public override List<Paragraph> Paragraphs
{
get
{
List<Paragraph> paragraphs = base.Paragraphs;
foreach (Paragraph p in paragraphs)
p.PackagePart = row.table.mainPart;
return paragraphs;
}
} }
public Color Shading public Color Shading

Notiek ielāde…
Atcelt
Saglabāt