瀏覽代碼

Add columns fix

Able to add columns to tables where each row have different amount of
cells
master
Michal Maciejewski 9 年之前
父節點
當前提交
a73cec2acd
共有 6 個檔案被更改,包括 496 行新增2692 行删除
  1. 309
    189
      DocX/Table.cs
  2. 13
    1979
      DocX/XMLFile1.xml
  3. 63
    490
      DocX/XMLFile2.xml
  4. 10
    15
      DocX/XMLFile3.xml
  5. 二進制
      DocX/bin/Debug/DocX.dll
  6. 101
    19
      UnitTests/DocXUnitTests.cs

+ 309
- 189
DocX/Table.cs 查看文件

@@ -56,7 +56,7 @@ namespace Novacode
* null will be returned if no such element exists.
*/
XElement start_tcPr = null;
if(columnIndex > Rows[startRow].Cells.Count)
if (columnIndex > Rows[startRow].Cells.Count)
start_tcPr = Rows[startRow].Cells[Rows[startRow].Cells.Count - 1].Xml.Element(XName.Get("tcPr", DocX.w.NamespaceName));
else
start_tcPr = Rows[startRow].Cells[columnIndex].Xml.Element(XName.Get("tcPr", DocX.w.NamespaceName));
@@ -206,7 +206,7 @@ namespace Novacode
if (r.Cells.Count > c)
r.Cells[c].Width = widths[c];
}
}
}
@@ -269,7 +269,7 @@ namespace Novacode
tblCellMar.AddFirst(new XElement(XName.Get(type.ToString(), DocX.w.NamespaceName)));
tblMargin = tblCellMar.Element(XName.Get(type.ToString(), DocX.w.NamespaceName));
}
tblMargin.RemoveAttributes();
// set the value for the cell margin
tblMargin.Add(new XAttribute(XName.Get("w", DocX.w.NamespaceName), margin));
@@ -284,7 +284,7 @@ namespace Novacode
public Double GetColumnWidth(Int32 index)
{
List<Double> widths = ColumnWidths;
if (widths == null || index > widths.Count -1) return Double.NaN;
if (widths == null || index > widths.Count - 1) return Double.NaN;
return widths[index];
}
@@ -492,14 +492,14 @@ namespace Novacode
}
}
/// <summary>
/// String containing the Table Caption value (the table's Alternate Text Title)
/// </summary>
private string _tableCaption;
/// <summary>
/// Gets or Sets the value of the Table Caption (Alternate Text Title) of this table.
/// </summary>
public string TableCaption
/// <summary>
/// String containing the Table Caption value (the table's Alternate Text Title)
/// </summary>
private string _tableCaption;
/// <summary>
/// Gets or Sets the value of the Table Caption (Alternate Text Title) of this table.
/// </summary>
public string TableCaption
{
set
{
@@ -514,7 +514,7 @@ namespace Novacode
tblCaption = new XElement(XName.Get("tblCaption", DocX.w.NamespaceName),
new XAttribute(XName.Get("val", DocX.w.NamespaceName), value));
tblPr.Add(tblCaption);
tblPr.Add(tblCaption);
}
}
@@ -685,7 +685,7 @@ namespace Novacode
tableAttributeValue = columnAttributeValue = "dxa";
XElement tblPr = Xml.Element(XName.Get("tblPr", DocX.w.NamespaceName));
XElement tblLayout = tblPr.Element(XName.Get("tblLayout", DocX.w.NamespaceName));
XElement tblLayout = tblPr.Element(XName.Get("tblLayout", DocX.w.NamespaceName));
if (tblLayout == null)
{
@@ -709,7 +709,9 @@ namespace Novacode
break;
} else {
}
else
{
var qry = from d in Xml.Descendants()
let type = d.Attribute(XName.Get("type", DocX.w.NamespaceName))
where (d.Name.LocalName == "tblLayout") && type != null
@@ -1305,7 +1307,7 @@ namespace Novacode
/// </example>
public void InsertColumn()
{
InsertColumn(ColumnCount);
InsertColumn(ColumnCount, true);
}
/// <summary>
@@ -1508,6 +1510,7 @@ namespace Novacode
/// Insert a column into a table.
/// </summary>
/// <param name="index">The index to insert the column at.</param>
/// <param name="direction">The side in which you wish to place the colum(True right, false left)</param>
/// <example>
/// Insert a column to the left of a table.
/// <code>
@@ -1518,7 +1521,7 @@ namespace Novacode
/// Table table = document.Tables[0];
///
/// // Insert a new column to this left of this table.
/// table.InsertColumn(0);
/// table.InsertColumn(0, false);
///
/// // Set the new columns text to "Row no."
/// table.Rows[0].Cells[table.ColumnCount - 1].Paragraph.InsertText("Row no.", false);
@@ -1543,11 +1546,12 @@ namespace Novacode
/// }// Release this document from memory.
/// </code>
/// </example>
public void InsertColumn(int index)
public void InsertColumn(int index, bool direction)
{
var columnCount = ColumnCount;
if (RowCount > 0)
{
if(index <= this.ColumnCount)
if (index > 0 && index <= columnCount)
{
_cachedColCount = -1;
foreach (Row r in Rows)
@@ -1558,44 +1562,148 @@ namespace Novacode
// insert cell
// checks if it is in bounds of index
// TODO: Check for gridspan of cells in row to check if merged cells
if (r.Cells.Count < index || r.Cells.Count < this.ColumnCount)
if (r.Cells.Count < columnCount)
{
var position = 0;
foreach(Cell rowCell in r.Cells)
if (index >= columnCount)
{
AddCellToRow(r, cell, r.Cells.Count, direction);
}
else
{
position += 1;
var grid = 0;
XElement tcPr = rowCell.Xml.Element(XName.Get("tcPr", DocX.w.NamespaceName));
if (tcPr != null)
bool directionTest = true;
var positionIndex = 1;
var actualPosition = 1;
var gridAfterVal = 0;
// checks to see if here is a deleted cell
XElement trPr = r.Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr != null)
{
XElement gridSpan = tcPr.Element(XName.Get("gridSpan", DocX.w.NamespaceName));
if (gridSpan != null)
XElement gridAfter = trPr.Element(XName.Get("gridAfter", DocX.w.NamespaceName));
if (gridAfter != null)
{
XAttribute val = gridSpan.Attribute(XName.Get("val", DocX.w.NamespaceName));
int value = 0;
XAttribute val = gridAfter.Attribute(XName.Get("val", DocX.w.NamespaceName));
if (val != null)
if (int.TryParse(val.Value, out value))
grid = value;
{
gridAfterVal = int.Parse(val.Value);
}
}
}
if(position + grid >= index)
// goes through iteration of cells to find the one the that contains the index number
foreach (Cell rowCell in r.Cells)
{
r.Cells[r.Cells.Count - 1].Xml.AddAfterSelf(cell);
break;
var gridSpanVal = 0;
XElement tcPr = rowCell.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))
gridSpanVal = value -1;
}
}
// Sees if the cell has gridSpan and if the index is within its lowest and highest cell value
if ((index - gridAfterVal) >= actualPosition
&& (index - gridAfterVal) <= (actualPosition + gridSpanVal))
{
if (index == (actualPosition + gridSpanVal) && direction == true)
{
directionTest = true;
}
else
{
directionTest = false;
}
AddCellToRow(r, cell, positionIndex, directionTest);
break;
}
positionIndex += 1;
actualPosition += gridSpanVal + 1;
}
}
}
}
else if (r.Cells.Count == index)
r.Cells[index - 1].Xml.AddAfterSelf(cell);
{
AddCellToRow(r, cell, index, direction);
}
else
r.Cells[index].Xml.AddBeforeSelf(cell);
AddCellToRow(r, cell, index, direction);
}
}
else
{
throw new IndexOutOfRangeException("Out of index bounds, column count is " + columnCount + " you input " + index);
}
}
}
/// <summary>
/// Adds a cell to the right or left of a cell
/// </summary>
/// <param name="row">is the row you are adding</param>
/// <param name="cell">is the cell you are adding</param>
/// <param name="index">the cell index position you are refferencing from</param>
/// <param name="direction">which side of the cell you wish to add cell</param>
private void AddCellToRow(Row row, XElement cell, int index, bool direction)
{
index -= 1;
if (direction)
{
row.Cells[index].Xml.AddAfterSelf(cell);
}
else
{
row.Cells[index].Xml.AddBeforeSelf(cell);
}
}
public void DeleteAndShiftCellsLeft(int rowIndex, int celIndex)
{
XAttribute gridAfterVal = new XAttribute(XName.Get("val", DocX.w.NamespaceName), 0);
var trPr = Rows[rowIndex].Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr != null)
{
var gridAfter = trPr.Element(XName.Get("gridAfter", DocX.w.NamespaceName));
if (gridAfter != null)
{
var val = gridAfter.Attribute(XName.Get("val", DocX.w.NamespaceName));
if (val != null)
{
val.Value = int.Parse(val.Value + 1).ToString();
}
else
{
val.Value = "1";
}
}
else
{
throw new NullReferenceException("Out of index bounds, column count is " + this.ColumnCount + " you input " + index);
}
var gridAfterElement = new XElement("gridAfter");
var gridAfterValAttribute = new XAttribute("val", 1);
gridAfter.SetAttributeValue("val", 1);
}
}
else
{
XElement trPrXElement = new XElement(XName.Get("trPr",DocX.w.NamespaceName));
XElement gridAfterElement = new XElement(XName.Get("gridAfter", DocX.w.NamespaceName));
XAttribute gridAfterValAttribute = new XAttribute(XName.Get("val", DocX.w.NamespaceName), 1);
gridAfterElement.Add(gridAfterValAttribute);
trPrXElement.Add(gridAfterElement);
Rows[rowIndex].Xml.AddFirst(trPrXElement);
}
var columnCount = this.ColumnCount;
if (celIndex <= this.ColumnCount && this.Rows[rowIndex].ColumnCount <= this.ColumnCount)
{
Rows[rowIndex].Cells[celIndex].Xml.Remove();
}
}
@@ -2065,79 +2173,79 @@ namespace Novacode
/// <param name="borderType">The table border to set</param>
/// <param name="border">Border object to set the table border</param>
public void SetBorder(TableBorderType borderType, Border border)
{
/*
{
/*
* Get the tblPr (table properties) element for this Table,
* null will be return if no such element exists.
*/
XElement tblPr = Xml.Element(XName.Get("tblPr", DocX.w.NamespaceName));
if (tblPr == null)
{
Xml.SetElementValue(XName.Get("tblPr", DocX.w.NamespaceName), string.Empty);
tblPr = Xml.Element(XName.Get("tblPr", DocX.w.NamespaceName));
}
/*
XElement tblPr = Xml.Element(XName.Get("tblPr", DocX.w.NamespaceName));
if (tblPr == null)
{
Xml.SetElementValue(XName.Get("tblPr", DocX.w.NamespaceName), string.Empty);
tblPr = Xml.Element(XName.Get("tblPr", DocX.w.NamespaceName));
}
/*
* Get the tblBorders (table borders) element for this Table,
* null will be return if no such element exists.
*/
XElement tblBorders = tblPr.Element(XName.Get("tblBorders", DocX.w.NamespaceName));
if (tblBorders == null)
{
tblPr.SetElementValue(XName.Get("tblBorders", DocX.w.NamespaceName), string.Empty);
tblBorders = tblPr.Element(XName.Get("tblBorders", DocX.w.NamespaceName));
}
/*
XElement tblBorders = tblPr.Element(XName.Get("tblBorders", DocX.w.NamespaceName));
if (tblBorders == null)
{
tblPr.SetElementValue(XName.Get("tblBorders", DocX.w.NamespaceName), string.Empty);
tblBorders = tblPr.Element(XName.Get("tblBorders", DocX.w.NamespaceName));
}
/*
* Get the 'borderType' (table border) element for this Table,
* null will be return if no such element exists.
*/
string tbordertype;
tbordertype = borderType.ToString();
// only lower the first char of string (because of insideH and insideV)
tbordertype = tbordertype.Substring(0, 1).ToLower() + tbordertype.Substring(1);
XElement tblBorderType = tblBorders.Element(XName.Get(borderType.ToString(), DocX.w.NamespaceName));
if (tblBorderType == null)
{
tblBorders.SetElementValue(XName.Get(tbordertype, DocX.w.NamespaceName), string.Empty);
tblBorderType = tblBorders.Element(XName.Get(tbordertype, DocX.w.NamespaceName));
}
// get string value of border style
string borderstyle = border.Tcbs.ToString().Substring(5);
borderstyle = borderstyle.Substring(0, 1).ToLower() + borderstyle.Substring(1);
// The val attribute is used for the border style
tblBorderType.SetAttributeValue(XName.Get("val", DocX.w.NamespaceName), borderstyle);
if (border.Tcbs != BorderStyle.Tcbs_nil)
{
int size;
switch (border.Size)
{
case BorderSize.one: size = 2; break;
case BorderSize.two: size = 4; break;
case BorderSize.three: size = 6; break;
case BorderSize.four: size = 8; break;
case BorderSize.five: size = 12; break;
case BorderSize.six: size = 18; break;
case BorderSize.seven: size = 24; break;
case BorderSize.eight: size = 36; break;
case BorderSize.nine: size = 48; break;
default: size = 2; break;
}
// The sz attribute is used for the border size
tblBorderType.SetAttributeValue(XName.Get("sz", DocX.w.NamespaceName), (size).ToString());
// The space attribute is used for the cell spacing (probably '0')
tblBorderType.SetAttributeValue(XName.Get("space", DocX.w.NamespaceName), (border.Space).ToString());
// The color attribute is used for the border color
string tbordertype;
tbordertype = borderType.ToString();
// only lower the first char of string (because of insideH and insideV)
tbordertype = tbordertype.Substring(0, 1).ToLower() + tbordertype.Substring(1);
XElement tblBorderType = tblBorders.Element(XName.Get(borderType.ToString(), DocX.w.NamespaceName));
if (tblBorderType == null)
{
tblBorders.SetElementValue(XName.Get(tbordertype, DocX.w.NamespaceName), string.Empty);
tblBorderType = tblBorders.Element(XName.Get(tbordertype, DocX.w.NamespaceName));
}
// get string value of border style
string borderstyle = border.Tcbs.ToString().Substring(5);
borderstyle = borderstyle.Substring(0, 1).ToLower() + borderstyle.Substring(1);
// The val attribute is used for the border style
tblBorderType.SetAttributeValue(XName.Get("val", DocX.w.NamespaceName), borderstyle);
if (border.Tcbs != BorderStyle.Tcbs_nil)
{
int size;
switch (border.Size)
{
case BorderSize.one: size = 2; break;
case BorderSize.two: size = 4; break;
case BorderSize.three: size = 6; break;
case BorderSize.four: size = 8; break;
case BorderSize.five: size = 12; break;
case BorderSize.six: size = 18; break;
case BorderSize.seven: size = 24; break;
case BorderSize.eight: size = 36; break;
case BorderSize.nine: size = 48; break;
default: size = 2; break;
}
// The sz attribute is used for the border size
tblBorderType.SetAttributeValue(XName.Get("sz", DocX.w.NamespaceName), (size).ToString());
// The space attribute is used for the cell spacing (probably '0')
tblBorderType.SetAttributeValue(XName.Get("space", DocX.w.NamespaceName), (border.Space).ToString());
// The color attribute is used for the border color
tblBorderType.SetAttributeValue(XName.Get("color", DocX.w.NamespaceName), border.Color.ToHex());
}
}
}
}
/// <summary>
/// Get a table border
@@ -2279,7 +2387,7 @@ namespace Novacode
}
return b;
}
}
/// <summary>
@@ -2295,7 +2403,19 @@ namespace Novacode
get
{
int gridSpanSum = 0;
var trPr = Xml.Element(XName.Get("trPr",DocX.w.NamespaceName));
if(trPr !=null)
{
var gridAfter = trPr.Element(XName.Get("gridAfter", DocX.w.NamespaceName));
if(gridAfter != null)
{
var val = gridAfter.Attribute(XName.Get("val", DocX.w.NamespaceName));
if(val != null)
{
gridSpanSum += int.Parse(val.Value);
}
}
}
// Foreach each Cell between startIndex and endIndex inclusive.
foreach (Cell c in Cells)
{
@@ -2495,41 +2615,41 @@ namespace Novacode
/// Set to true to make this row the table header row that will be repeated on each page
/// </summary>
public bool TableHeader
{
get
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
XElement tblHeader = trPr.Element(XName.Get("tblHeader", DocX.w.NamespaceName));
if (tblHeader == null)
{
return false;
}
else
{
return true;
}
}
set
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr == null)
{
Xml.SetElementValue(XName.Get("trPr", DocX.w.NamespaceName), string.Empty);
trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
}
XElement tblHeader = trPr.Element(XName.Get("tblHeader", DocX.w.NamespaceName));
if (tblHeader == null && value)
{
trPr.SetElementValue(XName.Get("tblHeader", DocX.w.NamespaceName), string.Empty);
}
if (tblHeader != null && !value)
{
tblHeader.Remove();
}
}
}
{
get
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
XElement tblHeader = trPr.Element(XName.Get("tblHeader", DocX.w.NamespaceName));
if (tblHeader == null)
{
return false;
}
else
{
return true;
}
}
set
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr == null)
{
Xml.SetElementValue(XName.Get("trPr", DocX.w.NamespaceName), string.Empty);
trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
}
XElement tblHeader = trPr.Element(XName.Get("tblHeader", DocX.w.NamespaceName));
if (tblHeader == null && value)
{
trPr.SetElementValue(XName.Get("tblHeader", DocX.w.NamespaceName), string.Empty);
}
if (tblHeader != null && !value)
{
tblHeader.Remove();
}
}
}
/// <summary>
/// Allow row to break across pages.
/// The default value is true: Word will break the contents of the row across pages.
@@ -2537,48 +2657,48 @@ namespace Novacode
/// </summary>
public bool BreakAcrossPages
{
get
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr == null)
return true;
XElement trCantSplit = trPr.Element(XName.Get("cantSplit", DocX.w.NamespaceName));
if (trCantSplit == null)
return true;
return false;
}
set
{
if (value == false)
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr == null)
{
Xml.SetElementValue(XName.Get("trPr", DocX.w.NamespaceName), string.Empty);
trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
}
XElement trCantSplit = trPr.Element(XName.Get("cantSplit", DocX.w.NamespaceName));
if (trCantSplit == null)
trPr.SetElementValue(XName.Get("cantSplit", DocX.w.NamespaceName), string.Empty);
}
if (value == true)
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr != null)
{
XElement trCantSplit = trPr.Element(XName.Get("cantSplit", DocX.w.NamespaceName));
if (trCantSplit != null)
trCantSplit.Remove();
}
}
}
get
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr == null)
return true;
XElement trCantSplit = trPr.Element(XName.Get("cantSplit", DocX.w.NamespaceName));
if (trCantSplit == null)
return true;
return false;
}
set
{
if (value == false)
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr == null)
{
Xml.SetElementValue(XName.Get("trPr", DocX.w.NamespaceName), string.Empty);
trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
}
XElement trCantSplit = trPr.Element(XName.Get("cantSplit", DocX.w.NamespaceName));
if (trCantSplit == null)
trPr.SetElementValue(XName.Get("cantSplit", DocX.w.NamespaceName), string.Empty);
}
if (value == true)
{
XElement trPr = Xml.Element(XName.Get("trPr", DocX.w.NamespaceName));
if (trPr != null)
{
XElement trCantSplit = trPr.Element(XName.Get("cantSplit", DocX.w.NamespaceName));
if (trCantSplit != null)
trCantSplit.Remove();
}
}
}
}
/// <summary>
@@ -2592,7 +2712,7 @@ namespace Novacode
// The sum of all merged gridSpans.
int gridSpanSum = 0;
// Foreach each Cell between startIndex and endIndex inclusive.
foreach (Cell c in Cells.Where((z, i) => i > startIndex && i <= endIndex))
{
@@ -2659,7 +2779,7 @@ namespace Novacode
public class Cell : Container
{
internal Row row;
internal Cell(Row row, DocX document, XElement xml)
: base(document, xml)
{
@@ -2684,9 +2804,9 @@ namespace Novacode
{
get
{
var somethin = int.Parse(this.Xml.Element(XName.Get("gridSpan", DocX.w.NamespaceName)).Attribute(XName.Get("Value",DocX.w.NamespaceName)).Value);
return somethin;
}
var somethin = int.Parse(this.Xml.Element(XName.Get("gridSpan", DocX.w.NamespaceName)).Attribute(XName.Get("Value", DocX.w.NamespaceName)).Value);
return somethin;
}
}
/// <summary>
@@ -3866,5 +3986,5 @@ namespace Novacode
public bool NoHorizontalBanding { get; set; }
public bool NoVerticalBanding { get; set; }
}
}

+ 13
- 1979
DocX/XMLFile1.xml
文件差異過大導致無法顯示
查看文件


+ 63
- 490
DocX/XMLFile2.xml 查看文件

@@ -4,552 +4,125 @@
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="TableGrid"/>
<w:tblW w:w="14629" w:type="dxa"/>
<w:tblInd w:w="-459" w:type="dxa"/>
<w:tblLayout w:type="fixed"/>
<w:tblW w:w="0" w:type="auto"/>
<w:tblLook w:val="04A0"/>
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="2722"/>
<w:gridCol w:w="709"/>
<w:gridCol w:w="5927"/>
<w:gridCol w:w="1757"/>
<w:gridCol w:w="878"/>
<w:gridCol w:w="879"/>
<w:gridCol w:w="1757"/>
<w:gridCol w:w="2319"/>
<w:gridCol w:w="2319"/>
<w:gridCol w:w="2315"/>
<w:gridCol w:w="2289"/>
</w:tblGrid>
<w:tr w:rsidR="00156C90" w:rsidRPr="00156C90" w:rsidTr="00B16F01">
<w:tr w:rsidR="00D73752" w:rsidTr="00D73752">
<w:trPr>
<w:tblHeader/>
<w:gridAfter w:val="1"/>
<w:wAfter w:w="2289" w:type="dxa"/>
<w:trHeight w:val="1408"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="9358" w:type="dxa"/>
<w:tcW w:w="6953" w:type="dxa"/>
<w:gridSpan w:val="3"/>
<w:shd w:val="clear" w:color="auto" w:fill="D9D9D9" w:themeFill="background1" w:themeFillShade="D9"/>
<w:vAlign w:val="center"/>
<w:vMerge w:val="restart"/>
</w:tcPr>
<w:p w:rsidR="00673925" w:rsidRPr="00B16F01" w:rsidRDefault="00673925" w:rsidP="0057642C">
<w:pPr>
<w:ind w:right="33"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00B16F01">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
<w:lastRenderedPageBreak/>
<w:t>Elements &amp; Performance</w:t>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752">
<w:r>
<w:t>a</w:t>
</w:r>
</w:p>
<w:p w:rsidR="00673925" w:rsidRPr="00B16F01" w:rsidRDefault="00673925" w:rsidP="0057642C">
<w:pPr>
<w:ind w:right="33"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00B16F01">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
<w:t xml:space="preserve">Criteria </w:t>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752">
<w:r>
<w:t>c</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5271" w:type="dxa"/>
<w:gridSpan w:val="4"/>
<w:shd w:val="clear" w:color="auto" w:fill="D9D9D9" w:themeFill="background1" w:themeFillShade="D9"/>
</w:tcPr>
<w:p w:rsidR="00673925" w:rsidRPr="00B16F01" w:rsidRDefault="00673925" w:rsidP="005F50AD">
<w:pPr>
<w:ind w:right="34"/>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00B16F01">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
<w:t xml:space="preserve">Assessment event(s) </w:t>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752">
<w:r>
<w:t>g</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr w:rsidR="00156C90" w:rsidRPr="00156C90" w:rsidTr="00B16F01">
<w:trPr>
<w:trHeight w:val="624"/>
<w:tblHeader/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2722" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2" w:themeFill="background1" w:themeFillShade="F2"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="00C14077" w:rsidRPr="00B16F01" w:rsidRDefault="00C14077" w:rsidP="005F50AD">
<w:pPr>
<w:ind w:right="32"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00B16F01">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
<w:t xml:space="preserve">Element(s) </w:t>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752">
<w:r>
<w:t>d</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="709" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2" w:themeFill="background1" w:themeFillShade="F2"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="00C14077" w:rsidRPr="00B16F01" w:rsidRDefault="00C14077" w:rsidP="0057642C">
<w:pPr>
<w:ind w:right="33"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00B16F01">
<w:rPr>
<w:rFonts w:ascii="Arial" w:eastAsia="Times New Roman" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
<w:bCs/>
<w:lang w:eastAsia="en-AU"/>
</w:rPr>
<w:t>PC No</w:t>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752">
<w:r>
<w:t>d</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5927" w:type="dxa"/>
<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2" w:themeFill="background1" w:themeFillShade="F2"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="00C14077" w:rsidRPr="00B16F01" w:rsidRDefault="00C14077" w:rsidP="0057642C">
<w:pPr>
<w:ind w:right="33"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="00B16F01">
<w:rPr>
<w:rFonts w:ascii="Arial" w:eastAsia="Times New Roman" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
<w:bCs/>
<w:lang w:eastAsia="en-AU"/>
</w:rPr>
<w:t>Performance Criteria (PC)</w:t>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752" w:rsidP="00E942FF">
<w:r>
<w:t>F</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5271" w:type="dxa"/>
<w:gridSpan w:val="4"/>
<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2" w:themeFill="background1" w:themeFillShade="F2"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="00C14077" w:rsidRPr="00B16F01" w:rsidRDefault="00ED0E43" w:rsidP="00027C76">
<w:pPr>
<w:ind w:right="33"/>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:eastAsia="Times New Roman" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
<w:bCs/>
<w:lang w:eastAsia="en-AU"/>
</w:rPr>
</w:pPr>
<w:fldSimple w:instr=" MERGEFIELD Assessments \m \* MERGEFORMAT ">
<w:r w:rsidR="007916DD">
<w:rPr>
<w:b/>
<w:noProof/>
</w:rPr>
<w:t>«</w:t>
</w:r>
<w:r w:rsidR="007916DD" w:rsidRPr="007916DD">
<w:rPr>
<w:rFonts w:ascii="Arial" w:eastAsia="Times New Roman" w:hAnsi="Arial" w:cs="Arial"/>
<w:b/>
<w:bCs/>
<w:noProof/>
<w:lang w:eastAsia="en-AU"/>
</w:rPr>
<w:t>Assessments</w:t>
</w:r>
<w:r w:rsidR="007916DD">
<w:rPr>
<w:b/>
<w:noProof/>
</w:rPr>
<w:t>»</w:t>
</w:r>
</w:fldSimple>
</w:p>
</w:tc>
</w:tr>
<w:tr w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidTr="007916DD">
<w:trPr>
<w:trHeight w:val="848"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2722" w:type="dxa"/>
<w:vMerge w:val="restart"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:rPr>
<w:lang w:val="en-NZ"/>
</w:rPr>
</w:pPr>
<w:fldSimple w:instr=" MERGEFIELD Elements \* MERGEFORMAT ">
<w:r w:rsidRPr="007916DD">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:noProof/>
<w:lang w:eastAsia="en-AU"/>
</w:rPr>
<w:t>«Elements»</w:t>
</w:r>
</w:fldSimple>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="709" w:type="dxa"/>
<w:vMerge w:val="restart"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:rPr>
<w:lang w:val="en-NZ"/>
</w:rPr>
</w:pPr>
<w:fldSimple w:instr=" MERGEFIELD PC_Number \* MERGEFORMAT ">
<w:r w:rsidRPr="007916DD">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:noProof/>
<w:lang w:eastAsia="en-AU"/>
</w:rPr>
<w:t>«PC_Number»</w:t>
</w:r>
</w:fldSimple>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5927" w:type="dxa"/>
<w:vMerge w:val="restart"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:rPr>
<w:lang w:val="en-NZ"/>
</w:rPr>
</w:pPr>
<w:fldSimple w:instr=" MERGEFIELD Criterion \* MERGEFORMAT ">
<w:r w:rsidRPr="007916DD">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:noProof/>
<w:lang w:eastAsia="en-AU"/>
</w:rPr>
<w:t>«Criterion»</w:t>
</w:r>
</w:fldSimple>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:vMerge w:val="restart"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
<w:r w:rsidRPr="008A3F3D">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
<w:t>&lt;</w:t>
</w:r>
<w:r w:rsidRPr="008A3F3D">
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
<w:sz w:val="18"/>
<w:szCs w:val="18"/>
</w:rPr>
<w:t>Insert question number or task skill number from assessment tool that address the specific Performance criteria</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="878" w:type="dxa"/>
<w:vMerge w:val="restart"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="879" w:type="dxa"/>
<w:vMerge w:val="restart"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
</w:tc>
</w:tr>
<w:tr w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidTr="00AC5A44">
<w:tr w:rsidR="00D73752" w:rsidTr="00D73752">
<w:trPr>
<w:trHeight w:val="847"/>
<w:trHeight w:val="273"/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="2722" w:type="dxa"/>
<w:vMerge/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="709" w:type="dxa"/>
<w:vMerge/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5927" w:type="dxa"/>
<w:vMerge/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:vMerge/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="878" w:type="dxa"/>
<w:vMerge/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="879" w:type="dxa"/>
<w:tcW w:w="6953" w:type="dxa"/>
<w:gridSpan w:val="3"/>
<w:vMerge/>
<w:vAlign w:val="center"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:vAlign w:val="center"/>
<w:tcW w:w="2289" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w:rsidR="00D73752" w:rsidRDefault="00D73752"/>
</w:tc>
</w:tr>
<w:tr w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidTr="00336DE8">
<w:tc>
<w:tcPr>
<w:tcW w:w="2722" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="709" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5927" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tr w:rsidR="0072257A" w:rsidTr="0072257A">
<w:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:vAlign w:val="center"/>
<w:tcW w:w="2319" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
<w:p w:rsidR="0072257A" w:rsidRDefault="0072257A">
<w:r>
<w:t>g</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:gridSpan w:val="2"/>
<w:vAlign w:val="center"/>
<w:tcW w:w="2319" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
<w:p w:rsidR="0072257A" w:rsidRDefault="0072257A">
<w:r>
<w:t>h</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:vAlign w:val="center"/>
<w:tcW w:w="2315" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
<w:p w:rsidR="0072257A" w:rsidRDefault="0072257A">
<w:proofErr w:type="spellStart"/>
<w:r>
<w:t>i</w:t>
</w:r>
<w:proofErr w:type="spellEnd"/>
</w:p>
</w:tc>
</w:tr>
<w:tr w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidTr="00B16F01">
<w:tc>
<w:tcPr>
<w:tcW w:w="2722" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="709" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5927" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="00ED0E43" w:rsidRDefault="007916DD" w:rsidP="00673925"/>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="5271" w:type="dxa"/>
<w:gridSpan w:val="4"/>
<w:vAlign w:val="center"/>
<w:tcW w:w="2289" w:type="dxa"/>
</w:tcPr>
<w:p w:rsidR="007916DD" w:rsidRPr="008A3F3D" w:rsidRDefault="007916DD" w:rsidP="00673925">
<w:pPr>
<w:jc w:val="center"/>
<w:rPr>
<w:rFonts w:ascii="Arial" w:hAnsi="Arial" w:cs="Arial"/>
</w:rPr>
</w:pPr>
</w:p>
<w:p w:rsidR="0072257A" w:rsidRDefault="0072257A"/>
</w:tc>
</w:tr>
</w:tbl>
<w:p w:rsidR="00FB5292" w:rsidRDefault="00FB5292"/>
<w:sectPr w:rsidR="00FB5292" w:rsidSect="00FB5292">
<w:pgSz w:w="11906" w:h="16838"/>
<w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="708" w:footer="708" w:gutter="0"/>
<w:cols w:space="708"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
</w:document>

+ 10
- 15
DocX/XMLFile3.xml 查看文件

@@ -1,15 +1,10 @@
<?xml version="1.0"?>
<w:tc xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:tcPr>
<w:tcW w:w="2310" w:type="dxa"/>
</w:tcPr>
<w:p>
<w:pPr/>
<w:r>
<w:rPr>
<w:lang w:val="en-GB"/>
</w:rPr>
<w:t>Hello</w:t>
</w:r>
</w:p>
</w:tc>
<w:tr xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:tc>
<w:tcPr>
<w:tcW w:w="2310" w:type="dxa" />
</w:tcPr>
<w:p>
<w:pPr />
</w:p>
</w:tc>
</w:tr>

二進制
DocX/bin/Debug/DocX.dll 查看文件


+ 101
- 19
UnitTests/DocXUnitTests.cs 查看文件

@@ -1400,6 +1400,102 @@ namespace UnitTests
}
}
[Test]
public void Test_Table_InsertRow()
{
using (DocX document = DocX.Create(Path.Combine(_directoryDocuments, "Tables3.docx")))
{
//Add A table
Table t = document.AddTable(2, 3);
t.Design = TableDesign.TableGrid;
Table t1 = document.InsertTable(t);
t1.MergeCellsInColumn(1, 0, 1);
t1.InsertRow();
t1.Rows[2].MergeCells(1, 3);
t1.InsertRow(3);
document.SaveAs(@"C:\\Meh\\ThisTest.docx");
}
}
[Test]
public void Test_Table_AddColumnWithCellDeleted()
{
using (DocX document = DocX.Create(Path.Combine(_directoryDocuments, "Tables3.docx")))
{
//Add A table
Table t = document.AddTable(2, 3);
t.Design = TableDesign.TableGrid;
Table t1 = document.InsertTable(t);
t1.DeleteAndShiftCellsLeft(0, 1);
t1.InsertColumn();
t1.DeleteAndShiftCellsLeft(0, 1);
t1.InsertColumn();
document.Save();
document.SaveAs(@"C:\\Meh\\ThisTest.docx");
}
}
[Test]
public void Test_Table_DeleteCellInRow()
{
using (DocX document = DocX.Create(Path.Combine(_directoryDocuments, "Tables3.docx")))
{
//Add A table
Table t = document.AddTable(2, 2);
t.Design = TableDesign.TableGrid;
Table t1 = document.InsertTable(t);
t1.DeleteAndShiftCellsLeft(0, 1);
document.Save();
document.SaveAs(@"C:\\Meh\\ThisTest.docx");
}
}
[Test]
public void Test_Table_InsertColumnWithMergedCells()
{
using (DocX document = DocX.Create(Path.Combine(_directoryDocuments, "Tables3.docx")))
{
//Add A table
Table t = document.AddTable(2, 2);
t.Design = TableDesign.TableGrid;
Table t1 = document.InsertTable(t);
t1.InsertColumn(2, true);
t1.InsertColumn(2, true);
t1.InsertColumn(2, true);
t1.InsertColumn(2, true);
t1.Rows[0].MergeCells(1, 4);
Assert.AreEqual(t1.Rows[1].Cells.Count, 6);
Assert.AreEqual(t1.ColumnCount, 6);
foreach (Row r in t1.Rows)
{
foreach (Cell c in r.Cells)
{
c.Paragraphs[0].InsertText("Hello");
}
}
t1.InsertColumn(6, false);
Assert.AreEqual(t1.ColumnCount, 7);
Assert.IsTrue(String.IsNullOrEmpty(t1.Rows[0].Cells[2].Paragraphs[0].Text));
//Assert.IsTrue(String.IsNullOrEmpty(t1.Rows[1].Cells[6].Paragraphs[0].Text));
t1.InsertColumn();
t1.InsertColumn(3, true);
t1.InsertColumn(6, true);
t1.InsertColumn(6, true);
t1.InsertColumn(5, true);
//Assert.AreEqual(t1.ColumnCount, 8);
document.SaveAs(@"C:\\Meh\\ThisTest.docx");
}
}
[Test]
public void Test_Table_InsertRowAndColumn()
{
@@ -1419,7 +1515,7 @@ namespace UnitTests
Table t1 = document.InsertTable(t);
// ... and add a column and a row
t1.InsertRow(1);
t1.InsertColumn(1);
t1.InsertColumn(1, true);
// Save the document.
document.Save();
@@ -1427,34 +1523,20 @@ namespace UnitTests
using (DocX document = DocX.Create(Path.Combine(_directoryDocuments, "Tables3.docx")))
{
//Add A table
Table t = document.AddTable(2, 2);
//Add A table
Table t = document.AddTable(2, 1);
t.Design = TableDesign.TableGrid;
Table t1 = document.InsertTable(t);
t1.InsertColumn(2);
t1.InsertColumn(2);
t1.InsertColumn(2);
t1.InsertColumn(2);
t1.Rows[0].MergeCells(1, 4);
Assert.AreEqual(t1.Rows[1].Cells.Count, 6);
Assert.AreEqual(t1.ColumnCount, 6);
foreach(Row r in t1.Rows)
foreach (Row r in t1.Rows)
{
foreach(Cell c in r.Cells)
foreach (Cell c in r.Cells)
{
c.Paragraphs[0].InsertText("Hello");
}
}
t1.InsertColumn(6);
Assert.AreEqual(t1.ColumnCount, 7);
Assert.IsTrue(String.IsNullOrEmpty(t1.Rows[0].Cells[3].Paragraphs[0].Text));
Assert.IsTrue(String.IsNullOrEmpty(t1.Rows[1].Cells[6].Paragraphs[0].Text));
}
// Check table
using (DocX document = DocX.Load(Path.Combine(_directoryDocuments, "Tables2.docx")))
{

Loading…
取消
儲存