本文整理汇总了C#中TableCell.Append方法的典型用法代码示例。如果您正苦于以下问题:C# TableCell.Append方法的具体用法?C# TableCell.Append怎么用?C# TableCell.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableCell
的用法示例。
在下文中一共展示了TableCell.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Format
public void Format(Body body, Scenario background)
{
var headerParagraph = new Paragraph(new ParagraphProperties(new ParagraphStyleId { Val = "Heading2" }));
var backgroundKeyword = GetLocalizedBackgroundKeyword();
headerParagraph.Append(new Run(new RunProperties(new Bold()), new Text(backgroundKeyword)));
var table = new Table();
table.Append(GenerateTableProperties());
var row = new TableRow();
var cell = new TableCell();
cell.Append(headerParagraph);
foreach (var descriptionSentence in WordDescriptionFormatter.SplitDescription(background.Description))
{
cell.Append(CreateNormalParagraph(descriptionSentence));
}
foreach (var step in background.Steps)
{
cell.Append(WordStepFormatter.GenerateStepParagraph(step));
if (step.TableArgument != null)
{
cell.Append(this.wordTableFormatter.CreateWordTableFromPicklesTable(step.TableArgument));
}
}
cell.Append(CreateNormalParagraph("")); // Is there a better way to generate a new empty line?
row.Append(cell);
table.Append(row);
body.Append(table);
}
示例2: CreateWordTableFromPicklesTable
public DocumentFormat.OpenXml.Wordprocessing.Table CreateWordTableFromPicklesTable(Table table)
{
var wordTable = new DocumentFormat.OpenXml.Wordprocessing.Table();
wordTable.Append(GenerateTableProperties());
var headerRow = new TableRow();
foreach (string cell in table.HeaderRow.Cells)
{
var wordCell = new TableCell();
wordCell.Append(new Paragraph(new Run(new Text(cell))));
headerRow.Append(wordCell);
}
wordTable.Append(headerRow);
foreach (ObjectModel.TableRow row in table.DataRows)
{
var wordRow = new TableRow();
foreach (string cell in row.Cells)
{
var wordCell = new TableCell();
wordCell.Append(new Paragraph(new Run(new Text(cell))));
wordRow.Append(wordCell);
}
wordTable.Append(wordRow);
}
return wordTable;
}
示例3: Format
public void Format(Body body, Table table)
{
var wordTable = new DocumentFormat.OpenXml.Wordprocessing.Table();
wordTable.Append(GenerateTableProperties());
var headerRow = new TableRow();
foreach (string cell in table.HeaderRow)
{
var wordCell = new TableCell();
wordCell.Append(new Paragraph(new Run(new Text(cell))));
headerRow.Append(wordCell);
}
wordTable.Append(headerRow);
foreach (ObjectModel.TableRow row in table.DataRows)
{
var wordRow = new TableRow();
foreach (string cell in row)
{
var wordCell = new TableCell();
wordCell.Append(new Paragraph(new Run(new Text(cell))));
wordRow.Append(wordCell);
}
wordTable.Append(wordRow);
}
body.Append(wordTable);
}
示例4: Format
public void Format(Body body, Table table)
{
var wordTable = new WordTable();
wordTable.Append(GenerateTableProperties());
var headerRow = new TableRow();
foreach (string cell in table.HeaderRow)
{
var wordCell = new TableCell();
wordCell.Append(new Paragraph(new Run(new Text(cell))));
headerRow.Append(wordCell);
}
wordTable.Append(headerRow);
foreach (Parser.TableRow row in table.DataRows)
{
var wordRow = new TableRow();
foreach (string cell in row)
{
var wordCell = new TableCell();
wordCell.Append(new Paragraph(new Run(new Text(cell))));
wordRow.Append(wordCell);
}
wordTable.Append(wordRow);
}
body.Append(wordTable);
}
示例5: AddSpacerCell
// Creates an TableCell instance and adds its children.
public static void AddSpacerCell(this TableRow row, string width = "173")
{
TableCell tableCell1 = new TableCell();
TableCellProperties tableCellProperties1 = new TableCellProperties();
TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = width, Type = TableWidthUnitValues.Dxa };
tableCellProperties1.Append(tableCellWidth1);
Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "005A43FA", RsidParagraphProperties = "005A43FA", RsidRunAdditionDefault = "005A43FA" };
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
Indentation indentation1 = new Indentation() { Left = "95", Right = "95" };
paragraphProperties1.Append(indentation1);
paragraph1.Append(paragraphProperties1);
tableCell1.Append(tableCellProperties1);
tableCell1.Append(paragraph1);
row.Append(tableCell1);
}
示例6: ToOpenXmlElements
public override IEnumerable<OpenXmlElement> ToOpenXmlElements(DocumentFormat.OpenXml.Packaging.MainDocumentPart mainDocumentPart)
{
TableCell result = new TableCell();
var cellProperties = new TableCellProperties();
if (!Width.IsEmpty)
{
var cellWidth = UnitHelper.Convert(Width).To<TableCellWidth>();
cellProperties.Append(cellWidth);
}
if (Colspan.HasValue)
{
var gridSpan = new GridSpan() { Val = Colspan };
cellProperties.Append(gridSpan);
}
result.Append(cellProperties);
var paraContent = new Paragraph();
ForEachChild(x =>
{
if (x is TextFormattedElement)
{
paraContent.Append(
new Run(x.ToOpenXmlElements(mainDocumentPart))
);
}
else
{
paraContent.Append(x.ToOpenXmlElements(mainDocumentPart));
}
});
result.Append(paraContent);
return new List<OpenXmlElement> { result };
}
示例7: AddCell
public static TableCell AddCell(OXMLParagraphWrap _paragraph)
{
var TC = new TableCell();
var TCProperties = new TableCellProperties();
var TCWidth = new TableCellWidth(){ Width = "0", Type = TableWidthUnitValues.Nil }; //говорим что ширину определяет Столбец
var TCVertAlign = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
TCProperties.Append(TCWidth);
TCProperties.Append(TCVertAlign);
TC.Append(TCProperties);
TC.Append(_paragraph.XMLParagraph);
return TC;
}
示例8: AddHeaderRow
private static void AddHeaderRow(DataTable table, Table wordTable, TableStyle tableStyle)
{
// Create a row.
TableRow tRow = new TableRow();
foreach (DataColumn iColumn in table.Columns) {
// Create a cell.
TableCell tCell = new TableCell();
TableCellProperties tCellProperties = new TableCellProperties();
// Set Cell Color
Shading tCellColor = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = System.Drawing.ColorTranslator.ToHtml(tableStyle.HeaderBackgroundColor) };
tCellProperties.Append(tCellColor);
// Append properties to the cell
tCell.Append(tCellProperties);
ParagraphProperties paragProperties = new ParagraphProperties();
Justification justification1 = new Justification() { Val = JustificationValues.Center };
SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { After = "0" };
paragProperties.Append(spacingBetweenLines1);
paragProperties.Append(justification1);
var parag = new Paragraph();
parag.Append(paragProperties);
var run = new Run(new Text(iColumn.ColumnName));
ApplyFontProperties(tableStyle, RowIdentification.Header, run);
parag.Append(run);
// Specify the table cell content.
tCell.Append(parag);
// Append the table cell to the table row.
tRow.Append(tCell);
}
// Append the table row to the table.
wordTable.Append(tRow);
}
示例9: CreateTable
private Table CreateTable(int? rowCount, int? columnCount)
{
//枠線、罫線ありの表を指定の行列分生成する
int realRowCount = GetRealRowCount(rowCount);
int realColumnCount = GetRealColumnCount(columnCount);
Table table = CreateDefaultTable();
for (int r = 0; r < realRowCount; r++)
{
TableRow tableRow = new TableRow();
table.Append(tableRow);
for (int c = 0; c < realColumnCount; c++)
{
TableCellProperties tableCellProperties = new TableCellProperties();
TableCellWidth tableCellWidth = new TableCellWidth() { Width = BOX_CELL_WIDTH.ToString(), Type = TableWidthUnitValues.Dxa };
tableCellProperties.Append(tableCellWidth);
TableCell tableCell = new TableCell();
tableCell.Append(tableCellProperties);
tableCell.Append(new Paragraph());
tableRow.Append(tableCell);
}
}
return table;
}
示例10: CreateLastNoBorderCell
private TableCell CreateLastNoBorderCell()
{
TableCellProperties tableCellProperties = new TableCellProperties();
TableCellWidth tableCellWidth = new TableCellWidth() { Type = TableWidthUnitValues.Auto };
TableCellBorders tableCellBorders1 = new TableCellBorders();
TopBorder topBorder1 = new TopBorder() { Val = BorderValues.Nil };
LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.Nil };
BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Nil };
RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.Nil };
tableCellBorders1.Append(topBorder1);
tableCellBorders1.Append(leftBorder1);
tableCellBorders1.Append(bottomBorder1);
tableCellBorders1.Append(rightBorder1);
tableCellProperties.Append(tableCellWidth);
tableCellProperties.Append(tableCellBorders1);
TableCell tableCell = new TableCell();
tableCell.Append(tableCellProperties);
tableCell.Append(CreateEmptyParagraph());
return tableCell;
}
示例11: CreateCenterCell
private TableCell CreateCenterCell(List<string> contents)
{
TableCellProperties tableCellProperties = new TableCellProperties();
//セルの幅の均等割はTableWidthUnitValues.Autoじゃなく、TableWidthUnitValues.Nilを使うのが正解?
TableCellWidth tableCellWidth = new TableCellWidth() { Width = "0", Type = TableWidthUnitValues.Nil };
tableCellProperties.Append(tableCellWidth);
TableCell tableCell = new TableCell();
tableCell.Append(tableCellProperties);
foreach (string content in contents)
{
tableCell.Append(CreateCenterParagraph(content));
}
return tableCell;
}
示例12: CreateBorderCell
private TableCell CreateBorderCell(int cellWidth)
{
//ボーダーつきのセルを生成する(幅指定あり)
TableCellProperties tableCellProperties = new TableCellProperties();
EnumValue<TableWidthUnitValues> type = cellWidth == 0 ? TableWidthUnitValues.Auto : TableWidthUnitValues.Dxa;
TableCellWidth tableCellWidth = new TableCellWidth() { Width = cellWidth.ToString(), Type = type };
tableCellProperties.Append(tableCellWidth);
TableCell tableCell = new TableCell();
tableCell.Append(tableCellProperties);
tableCell.Append(CreateEmptyParagraph());
return tableCell;
}
示例13: GenerateDocument
//.........这里部分代码省略.........
Color = "grey"
},
new RightBorder
{
Val = new EnumValue<BorderValues>(BorderValues.Single),
Size = 6,
Color = "grey"
},
new InsideHorizontalBorder
{
Val = new EnumValue<BorderValues>(BorderValues.Single),
Size = 6,
Color = "grey"
},
new InsideVerticalBorder
{
Val = new EnumValue<BorderValues>(BorderValues.Single),
Size = 6,
Color = "grey"
}));
//table.AppendChild<TableProperties>(props);
var uniqueRegions = _transactionDetailsList.Select(t => t.Region).Distinct();
var enumerable = uniqueRegions as List<string> ?? uniqueRegions.ToList();
foreach (var uniqueRegion in uniqueRegions)
{
var transactionDetailsListOfARegion = _transactionDetailsList.Where(t => t.Region == uniqueRegion);
var detailsListOfARegion = transactionDetailsListOfARegion as List<TransactionDetail> ?? transactionDetailsListOfARegion.ToList();
var firstOrDefault = detailsListOfARegion.FirstOrDefault();
var regionTr = new TableRow();
var regionTc = new TableCell();
var regionTcContent = new TableCell();
regionTc.Append(new Paragraph(new Run(new Text("Region: "))));
regionTcContent.Append(new Paragraph(new Run(new Text(uniqueRegion))));
regionTr.Append(regionTc);
regionTr.Append(regionTcContent);
table.Append(regionTr);
var bidNumberTr = new TableRow();
var bidNumberTc = new TableCell();
var bidNumberTcContent = new TableCell();
bidNumberTc.Append(new Paragraph(new Run(new Text("Bid Contract: "))));
if (firstOrDefault != null)
bidNumberTcContent.Append(new Paragraph(new Run(new Text(firstOrDefault.BidNumber))));
bidNumberTr.Append(bidNumberTc);
bidNumberTr.Append(bidNumberTcContent);
table.Append(bidNumberTr);
var bidDateTr = new TableRow();
var bidDateTc = new TableCell();
var bidDateTcContent = new TableCell();
bidDateTc.Append(new Paragraph(new Run(new Text("Bid Date: "))));
if (firstOrDefault != null)
bidDateTcContent.Append(new Paragraph(new Run(new Text(firstOrDefault.BidStratingDate))));
bidDateTr.Append(bidDateTc);
bidDateTr.Append(bidDateTcContent);
table.Append(bidDateTr);
var transactionTh = new TableRow();
var rowNoTh = new TableCell();
rowNoTh.Append(new Paragraph(new Run(new Text("No."))));
//zoneTh.Append(new TableCellProperties(new TableCellWidth { Type = TableWidthUnitValues.Auto}));
transactionTh.Append(rowNoTh);
示例14: GenerateTableRow
public TableRow GenerateTableRow(CellProps[] cellProps, UInt32Value height)
{
TableRow tableRow1 = new TableRow();
TableRowProperties tableRowProperties1 = generateTableRowProperties(height);
tableRow1.Append(tableRowProperties1);
foreach (CellProps cp in cellProps) {
if (cp.span == 0) continue;
TableCell tableCell1 = new TableCell();
TableCellProperties tableCellProperties1 = new TableCellProperties();
TableCellBorders tableCellBorders1 = generateTableCellBordersPlain();
Shading shading1 = new Shading() { Val = ShadingPatternValues.Clear, Color = "auto", Fill = "auto" };
NoWrap noWrap1 = new NoWrap();
TableCellVerticalAlignment tableCellVerticalAlignment1 = new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center };
HideMark hideMark1 = new HideMark();
if (cp.span > 1) {
GridSpan span = new GridSpan() { Val = (Int32Value)cp.span };
tableCellProperties1.Append(span);
}
tableCellProperties1.Append(tableCellBorders1);
tableCellProperties1.Append(shading1);
tableCellProperties1.Append(noWrap1);
tableCellProperties1.Append(tableCellVerticalAlignment1);
tableCellProperties1.Append(hideMark1);
Paragraph paragraph1 = new Paragraph();
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
Justification justification1 = new Justification() { Val = cp.align };
ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
FontSize fontSize1 = new FontSize() { Val = "18" };
FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "18" };
paragraphMarkRunProperties1.Append(fontSize1);
paragraphMarkRunProperties1.Append(fontSizeComplexScript1);
paragraphProperties1.Append(justification1);
paragraphProperties1.Append(paragraphMarkRunProperties1);
Run run1 = new Run();
RunProperties runProperties1 = new RunProperties();
FontSize fontSize2 = new FontSize() { Val = "18" };
FontSizeComplexScript fontSizeComplexScript2 = new FontSizeComplexScript() { Val = "18" };
runProperties1.Append(fontSize2);
runProperties1.Append(fontSizeComplexScript2);
run1.Append(runProperties1);
if (cp.text != null) {
Text text1 = new Text();
text1.Text = cp.text;
run1.Append(text1);
}
paragraph1.Append(paragraphProperties1);
paragraph1.Append(run1);
tableCell1.Append(tableCellProperties1);
tableCell1.Append(paragraph1);
tableRow1.Append(tableCell1);
}
return tableRow1;
}
示例15: AddPersonCell
// Creates an TableCell instance and adds its children.
public static void AddPersonCell(this TableRow row, Person p, bool addEmployer)
{
TableCell tableCell1 = new TableCell();
TableCellProperties tableCellProperties1 = new TableCellProperties();
TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = "3787", Type = TableWidthUnitValues.Dxa };
tableCellProperties1.Append(tableCellWidth1);
Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "005A43FA", RsidParagraphProperties = "005A43FA", RsidRunAdditionDefault = "005A43FA" };
ParagraphProperties paragraphProperties1 = new ParagraphProperties();
SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { Before = "111" };
Indentation indentation1 = new Indentation() { Left = "95", Right = "95" };
paragraphProperties1.Append(spacingBetweenLines1);
paragraphProperties1.Append(indentation1);
paragraph1.Append(paragraphProperties1);
if (p != null)
{
Run run1 = new Run();
Text text1 = new Text();
var name = (p.TitleCode.HasValue() ? p.TitleCode + " " : "")
+ (p.FirstName == "?" ? "" : p.FirstName + " ")
+ (p.LastName == "?" ? "" : p.LastName);
text1.Text = name;
run1.Append(text1);
paragraph1.Append(run1);
Paragraph paragraph2 = null;
if (addEmployer && p.EmployerOther.HasValue())
{
paragraph2 = new Paragraph()
{
RsidParagraphAddition = "005A43FA",
RsidParagraphProperties = "005A43FA",
RsidRunAdditionDefault = "005A43FA"
};
ParagraphProperties paragraphProperties2 = new ParagraphProperties();
Indentation indentation2 = new Indentation() { Left = "245", Right = "95", Hanging = "150" };
paragraphProperties2.Append(indentation2);
Run run2 = new Run();
Text text2 = new Text();
text2.Text = p.EmployerOther;
run2.Append(text2);
paragraph2.Append(paragraphProperties2);
paragraph2.Append(run2);
}
Paragraph paragraph3 = new Paragraph()
{
RsidParagraphAddition = "005A43FA",
RsidParagraphProperties = "005A43FA",
RsidRunAdditionDefault = "005A43FA"
};
ParagraphProperties paragraphProperties3 = new ParagraphProperties();
Indentation indentation3 = new Indentation() {Left = "95", Right = "95"};
paragraphProperties3.Append(indentation3);
Run run3 = new Run();
Text text3 = new Text();
text3.Text = p.PrimaryAddress;
run3.Append(text3);
paragraph3.Append(paragraphProperties3);
paragraph3.Append(run3);
Paragraph paragraph3a = null;
if (p.PrimaryAddress2.HasValue())
{
paragraph3a = new Paragraph()
{
RsidParagraphAddition = "005A43FA",
RsidParagraphProperties = "005A43FA",
RsidRunAdditionDefault = "005A43FA"
};
ParagraphProperties paragraphProperties2 = new ParagraphProperties();
Indentation indentation2 = new Indentation() {Left = "95", Right = "95"};
paragraphProperties2.Append(indentation2);
Run run2 = new Run();
Text text2 = new Text();
text2.Text = p.PrimaryAddress2;
run2.Append(text2);
//.........这里部分代码省略.........