coffeycathal_cp 14 anni fa
parent
commit
fbea5f0b5b
4 ha cambiato i file con 12 aggiunte e 9 eliminazioni
  1. 2
    2
      DocX/Container.cs
  2. 6
    6
      DocX/DocX.cs
  3. 1
    0
      Examples/Program.cs
  4. 3
    1
      UnitTests/UnitTest1.cs

+ 2
- 2
DocX/Container.cs Vedi File

return p; return p;
} }
public Table InsertTable(int coloumnCount, int rowCount)
public Table InsertTable(int rowCount, int coloumnCount)
{ {
XElement newTable = HelperFunctions.CreateTable(rowCount, coloumnCount); XElement newTable = HelperFunctions.CreateTable(rowCount, coloumnCount);
Xml.Elements().First().Add(newTable); Xml.Elements().First().Add(newTable);
return new Table(Document, newTable); return new Table(Document, newTable);
} }
public Table InsertTable(int index, int coloumnCount, int rowCount)
public Table InsertTable(int index, int rowCount, int coloumnCount)
{ {
XElement newTable = HelperFunctions.CreateTable(rowCount, coloumnCount); XElement newTable = HelperFunctions.CreateTable(rowCount, coloumnCount);

+ 6
- 6
DocX/DocX.cs Vedi File

/// }// Release this document from memory. /// }// Release this document from memory.
/// </code> /// </code>
/// </example> /// </example>
public new Table InsertTable(int coloumnCount, int rowCount)
public new Table InsertTable(int rowCount, int coloumnCount)
{ {
if (rowCount < 1 || coloumnCount < 1) if (rowCount < 1 || coloumnCount < 1)
throw new ArgumentOutOfRangeException("Row and Coloumn count must be greater than zero."); throw new ArgumentOutOfRangeException("Row and Coloumn count must be greater than zero.");
Table t = base.InsertTable(coloumnCount, rowCount);
Table t = base.InsertTable(rowCount, coloumnCount);
t.mainPart = mainPart; t.mainPart = mainPart;
return t; return t;
} }
/// // Create a document. /// // Create a document.
/// using (DocX document = DocX.Load(@"C:\Example\Test.docx")) /// using (DocX document = DocX.Load(@"C:\Example\Test.docx"))
/// { /// {
/// // Create a new Table with 2 coloumns and 3 rows. Insert this Table at index 37.
/// Table newTable = document.InsertTable(37, 2, 3);
/// // Create a new Table with 3 rows and 2 coloumns. Insert this Table at index 37.
/// Table newTable = document.InsertTable(37, 3, 2);
/// ///
/// // Set the design of this Table. /// // Set the design of this Table.
/// newTable.Design = TableDesign.LightShadingAccent3; /// newTable.Design = TableDesign.LightShadingAccent3;
/// }// Release this document from memory. /// }// Release this document from memory.
/// </code> /// </code>
/// </example> /// </example>
public new Table InsertTable(int index, int coloumnCount, int rowCount)
public new Table InsertTable(int index, int rowCount, int coloumnCount)
{ {
if (rowCount < 1 || coloumnCount < 1) if (rowCount < 1 || coloumnCount < 1)
throw new ArgumentOutOfRangeException("Row and Column count must be greater than zero."); throw new ArgumentOutOfRangeException("Row and Column count must be greater than zero.");
Table t = InsertTable(index, coloumnCount, rowCount);
Table t = InsertTable(index, rowCount, coloumnCount);
t.mainPart = mainPart; t.mainPart = mainPart;
return t; return t;
} }

+ 1
- 0
Examples/Program.cs Vedi File

// Indent only the first line of the Paragraph. // Indent only the first line of the Paragraph.
p.IndentationFirstLine = 1.0f; p.IndentationFirstLine = 1.0f;
// Save all changes made to this document. // Save all changes made to this document.
document.Save(); document.Save();
Console.WriteLine("\tCreated: docs\\Indentation.docx\n"); Console.WriteLine("\tCreated: docs\\Indentation.docx\n");

+ 3
- 1
UnitTests/UnitTest1.cs Vedi File

using (DocX document = DocX.Create("test.docx")) using (DocX document = DocX.Create("test.docx"))
{ {
Hyperlink h = document.AddHyperlink("follow me", new Uri("http://www.google.com")); Hyperlink h = document.AddHyperlink("follow me", new Uri("http://www.google.com"));
Table t = document.AddTable(2, 2);
Table t = document.AddTable(2, 3);
int cc = t.ColumnCount;
Paragraph p = t.Rows[0].Cells[0].Paragraphs[0]; Paragraph p = t.Rows[0].Cells[0].Paragraphs[0];
p.AppendHyperlink(h); p.AppendHyperlink(h);
} }

Loading…
Annulla
Salva