Bläddra i källkod

Modifying InsertColumn Method

Allowing InsertColumn method take into account merged cells for multiple
row add columns where the count of cells is less than the index but is
not less table column count
master
Michal Maciejewski 9 år sedan
förälder
incheckning
375e86dc73
9 ändrade filer med 2659 tillägg och 13 borttagningar
  1. 7
    0
      DocX/DocX.csproj
  2. 57
    10
      DocX/Table.cs
  3. 1979
    0
      DocX/XMLFile1.xml
  4. 555
    0
      DocX/XMLFile2.xml
  5. 15
    0
      DocX/XMLFile3.xml
  6. Binär
      DocX/bin/Debug/DocX.dll
  7. 31
    0
      UnitTests/DocXUnitTests.cs
  8. 7
    3
      UnitTests/UnitTests.csproj
  9. 8
    0
      UnitTests/packages.config

+ 7
- 0
DocX/DocX.csproj Visa fil

@@ -136,6 +136,13 @@
</ItemGroup>
<ItemGroup>
<Content Include="License\License.html" />
<Content Include="XMLFile1.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="XMLFile2.xml">
<SubType>Designer</SubType>
</Content>
<Content Include="XMLFile3.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\default_styles.xml.gz" />

+ 57
- 10
DocX/Table.cs Visa fil

@@ -1547,18 +1547,55 @@ namespace Novacode
{
if (RowCount > 0)
{
_cachedColCount = -1;
foreach (Row r in Rows)
if(index <= this.ColumnCount)
{
// create cell
XElement cell = HelperFunctions.CreateTableCell();
_cachedColCount = -1;
foreach (Row r in Rows)
{
// create cell
XElement cell = HelperFunctions.CreateTableCell();
// insert cell
if (r.Cells.Count == index)
r.Cells[index - 1].Xml.AddAfterSelf(cell);
else
r.Cells[index].Xml.AddBeforeSelf(cell);
// 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)
{
var position = 0;
foreach(Cell rowCell in r.Cells)
{
position += 1;
var grid = 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))
grid = value;
}
}
if(position + grid >= index)
{
r.Cells[r.Cells.Count - 1].Xml.AddAfterSelf(cell);
break;
}
}
}
else if (r.Cells.Count == index)
r.Cells[index - 1].Xml.AddAfterSelf(cell);
else
r.Cells[index].Xml.AddBeforeSelf(cell);
}
}
else
{
throw new NullReferenceException("Out of index bounds, column count is " + this.ColumnCount + " you input " + index);
}
}
}
@@ -2555,7 +2592,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))
{
@@ -2622,6 +2659,7 @@ namespace Novacode
public class Cell : Container
{
internal Row row;
internal Cell(Row row, DocX document, XElement xml)
: base(document, xml)
{
@@ -2642,6 +2680,15 @@ namespace Novacode
}
}
public int GridSpan
{
get
{
var somethin = int.Parse(this.Xml.Element(XName.Get("gridSpan", DocX.w.NamespaceName)).Attribute(XName.Get("Value",DocX.w.NamespaceName)).Value);
return somethin;
}
}
/// <summary>
/// Gets or Sets this Cells vertical alignment.
/// </summary>

+ 1979
- 0
DocX/XMLFile1.xml
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 555
- 0
DocX/XMLFile2.xml Visa fil

@@ -0,0 +1,555 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
<w:body>
<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: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:tblGrid>
<w:tr w:rsidR="00156C90" w:rsidRPr="00156C90" w:rsidTr="00B16F01">
<w:trPr>
<w:tblHeader/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="9358" 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: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: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: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: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: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: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: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:trPr>
<w:trHeight w:val="847"/>
</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: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="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="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: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:tc>
<w:tcPr>
<w:tcW w:w="1757" w:type="dxa"/>
<w:gridSpan w:val="2"/>
<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="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: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:tbl>
</w:body>
</w:document>

+ 15
- 0
DocX/XMLFile3.xml Visa fil

@@ -0,0 +1,15 @@
<?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>

Binär
DocX/bin/Debug/DocX.dll Visa fil


+ 31
- 0
UnitTests/DocXUnitTests.cs Visa fil

@@ -135,6 +135,7 @@ namespace UnitTests
}
[Test]
public void TestPatternFuncReplacement()
{
@@ -1424,6 +1425,36 @@ namespace UnitTests
document.Save();
}
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);
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(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")))
{

+ 7
- 3
UnitTests/UnitTests.csproj Visa fil

@@ -18,6 +18,8 @@
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -48,8 +50,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\DocX\bin\Debug\DocX.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=3.4.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.4.1\lib\net40\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\nunit.framework.2.63.0\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
@@ -139,7 +141,9 @@
<None Include="documents\VariousTextFormatting.docx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="documents\green.jpg">

+ 8
- 0
UnitTests/packages.config Visa fil

@@ -1,4 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit" version="3.4.1" targetFramework="net40" />
<package id="NUnit.Console" version="3.4.1" targetFramework="net40" />
<package id="NUnit.ConsoleRunner" version="3.4.1" targetFramework="net40" />
<package id="NUnit.Extension.NUnitProjectLoader" version="3.4.1" targetFramework="net40" />
<package id="NUnit.Extension.NUnitV2Driver" version="3.4.1" targetFramework="net40" />
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.4.1" targetFramework="net40" />
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.1" targetFramework="net40" />
<package id="NUnit.Extension.VSProjectLoader" version="3.4.1" targetFramework="net40" />
<package id="nunit.framework" version="2.63.0" targetFramework="net40" />
</packages>

Laddar…
Avbryt
Spara