本文整理汇总了C#中TableRow.Append方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.Append方法的具体用法?C# TableRow.Append怎么用?C# TableRow.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableRow
的用法示例。
在下文中一共展示了TableRow.Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPersonsRow
// Creates an TableRow instance and adds its children.
public static TableRow AddPersonsRow()
{
TableRow tableRow1 = new TableRow() { RsidTableRowAddition = "005A43FA" };
TablePropertyExceptions tablePropertyExceptions1 = new TablePropertyExceptions();
TableCellMarginDefault tableCellMarginDefault1 = new TableCellMarginDefault();
TopMargin topMargin1 = new TopMargin() { Width = "0", Type = TableWidthUnitValues.Dxa };
BottomMargin bottomMargin1 = new BottomMargin() { Width = "0", Type = TableWidthUnitValues.Dxa };
tableCellMarginDefault1.Append(topMargin1);
tableCellMarginDefault1.Append(bottomMargin1);
tablePropertyExceptions1.Append(tableCellMarginDefault1);
TableRowProperties tableRowProperties1 = new TableRowProperties();
CantSplit cantSplit1 = new CantSplit();
TableRowHeight tableRowHeight1 = new TableRowHeight() { Val = (UInt32Value)1440U, HeightType = HeightRuleValues.Exact };
tableRowProperties1.Append(cantSplit1);
tableRowProperties1.Append(tableRowHeight1);
tableRow1.Append(tablePropertyExceptions1);
tableRow1.Append(tableRowProperties1);
return tableRow1;
}
示例2: EasyTable
//Creates "2x2" table
//with default properties applied
public EasyTable()
{
Properties properties = Properties.byDefault;
table = new Table();
TableRow tr;
TableCell tc;
//Adding default borders
AddBorders(properties);
//Two rows
for (int i = 0; i < 2; i++ )
{
tr = new TableRow();
//Two cells in each row
for (int j = 0; j < 2; j++ )
{
//Empty table cell with no identation
tc = new TableCell(new Paragraph
(new ParagraphProperties
(new Indentation() { FirstLine = "0" }),
(new Run
(new Text("")))));
tr.Append(tc);
}
table.Append(tr);
}
}
示例3: AddRow
public static TableRow AddRow(int countColumns)
{
var TR = new TableRow();
for (int i = 0; i < countColumns; i++)
TR.Append(OXMLTableCellWrap.AddCell(new OXMLParagraphWrap()));
return TR;
}
示例4: 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);
}
示例5: 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);
}
示例6: 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;
}
示例7: ToOpenXmlElements
public override IEnumerable<OpenXmlElement> ToOpenXmlElements(DocumentFormat.OpenXml.Packaging.MainDocumentPart mainDocumentPart)
{
TableRow result = new TableRow();
ForEachChild(x =>
{
Debug.Assert(x is TableCellFormattedElement);
result.Append(x.ToOpenXmlElements(mainDocumentPart));
});
return new List<OpenXmlElement> { result };
}
示例8: Process
internal void Process(TableRow row, DocxTableProperties docxProperties)
{
TableRowProperties trProperties = new TableRowProperties();
if (docxProperties.CellSpacing != null)
{
trProperties.Append(new TableCellSpacing() {
Width = DocxUnits.GetDxaFromPixel(docxProperties.CellSpacing.Value).ToString(),
Type = TableWidthUnitValues.Dxa
});
}
if (trProperties.ChildElements.Count > 0)
{
row.Append(trProperties);
}
}
示例9: CreateDateTimeResponseRowEn
private TableRow CreateDateTimeResponseRowEn(QuestionVM question, string prefix)
{
ResponseVM response = question.Response;
DateTimeLayoutVM dateTimeLayout = (DateTimeLayoutVM)response.Layout;
TableRow tableRow = new TableRow();
TableCell cell = null;
List<TableCell> cells = null;
//月の入力欄
if (HasMonth(response))
{
cell = CreateNoBorderCell(Resources.WordMonth);
tableRow.Append(cell);
cells = CreateNumberInputCells(dateTimeLayout.Style, 2);
tableRow.Append(cells);
}
//日の入力欄
if (HasDay(response))
{
cell = CreateNoBorderCell(Resources.WordDay);
tableRow.Append(cell);
cells = CreateNumberInputCells(dateTimeLayout.Style, 2);
tableRow.Append(cells);
}
//年の入力欄
string yearLabel = Resources.WordYear;
if (dateTimeLayout.CalendarEra == DateTimeLayoutCalendarEra.Japanese)
{
yearLabel += "[" + Resources.JapaneseEraTSH + "]";
}
cell = CreateNoBorderCell(yearLabel);
tableRow.Append(cell);
cells = CreateNumberInputCells(dateTimeLayout.Style, 4);
tableRow.Append(cells);
//時間の入力欄
if (HasTime(response))
{
cells = CreateNumberInputCells(dateTimeLayout.Style, 2);
tableRow.Append(cells);
CreateNoBorderCell(":");
cells = CreateNumberInputCells(dateTimeLayout.Style, 2);
tableRow.Append(cells);
}
if (!string.IsNullOrEmpty(prefix))
{
tableRow.Append(CreateNoBorderCell(prefix));
}
TableCell lastCell = CreateLastNoBorderCell();
tableRow.Append(lastCell);
return tableRow;
}
示例10: CreateWordDocument
public byte[] CreateWordDocument(Schema schemaData, string templateLocation)
{
byte[] binFile = null;
byte[] byteArray = File.ReadAllBytes(templateLocation);
using (MemoryStream mem = new MemoryStream())
{
mem.Write(byteArray, 0, (int) byteArray.Length);
using (WordprocessingDocument doc = WordprocessingDocument.Open(mem, true))
{
Table table = doc.MainDocumentPart.Document.Body.GetFirstChild<Table>();
RunFonts textFonts =
table.GetFirstChild<TableRow>().GetFirstChild<TableCell>().GetFirstChild<Paragraph>().
GetFirstChild<ParagraphProperties>().GetFirstChild<ParagraphMarkRunProperties>().
GetFirstChild<RunFonts>();
string paragraphPropertiesOuterXml = getParagraphPropertiesXml(textFonts);
string runPropertiesOuterXml = getRunPropertiesXml(textFonts);
table.Elements<TableRow>().ElementAt(0).Elements<TableCell>().ElementAt(1).Elements<Paragraph>().ElementAt(0).Append(new Run(new RunProperties(runPropertiesOuterXml), new Text(schemaData.Title)));
table.Elements<TableRow>().ElementAt(1).Elements<TableCell>().ElementAt(1).Elements<Paragraph>().ElementAt(0).Append(new Run(new RunProperties(runPropertiesOuterXml), new Text(schemaData.Description)));
table.Elements<TableRow>().ElementAt(2).Elements<TableCell>().ElementAt(1).Elements<Paragraph>().ElementAt(0).Append(new Run(new RunProperties(runPropertiesOuterXml), new Text(schemaData.SchemaType + TEXT_SCHEMA)));
table.Elements<TableRow>().ElementAt(3).Elements<TableCell>().ElementAt(1).Elements<Paragraph>().ElementAt(0).Append(new Run(new RunProperties(runPropertiesOuterXml), new Text(schemaData.RootElementName)));
table.Elements<TableRow>().ElementAt(4).Elements<TableCell>().ElementAt(1).Elements<Paragraph>().ElementAt(0).Append(new Run(new RunProperties(runPropertiesOuterXml), new Text(schemaData.NamespaceUri)));
// Save properties for metadata row
TableRowProperties metaDataRowProperties =
table.Elements<TableRow>().ElementAt(5).GetFirstChild<TableRowProperties>();
TableCellProperties metaDataCellProperties =
table.Elements<TableRow>().ElementAt(5).GetFirstChild<TableCell>().GetFirstChild<TableCellProperties>();
ParagraphProperties metaDataParagraphProperties =
table.Elements<TableRow>().ElementAt(5).GetFirstChild<TableCell>().GetFirstChild<Paragraph>().GetFirstChild<ParagraphProperties>();
RunProperties metaDataRunProperties =
table.Elements<TableRow>().ElementAt(5).GetFirstChild<TableCell>().GetFirstChild<Paragraph>().GetFirstChild<Run>().GetFirstChild<RunProperties>();
// Clear empty rows
foreach (TableRow row in table.Elements<TableRow>())
{
Text text = row.Elements<TableCell>().ElementAt(1).GetFirstChild<Paragraph>().GetFirstChild<Run>().GetFirstChild<Text>();
if (string.IsNullOrEmpty(text.InnerText.Trim()))
{
table.RemoveChild(row);
}
}
foreach (SchemaField field in schemaData.Fields)
{
TableRow tr = new TableRow();
TableCell tc1 = new TableCell();
tc1.Append(new Paragraph(new ParagraphProperties(paragraphPropertiesOuterXml), new Run(new RunProperties(runPropertiesOuterXml), new Text(field.Description))));
tr.Append(tc1);
TableCell tc2 = new TableCell();
tc2.Append(new Paragraph(new ParagraphProperties(paragraphPropertiesOuterXml), new Run(new RunProperties(runPropertiesOuterXml), new Text(field.XmlName))));
tr.Append(tc2);
TableCell tc3 = new TableCell();
tc3.Append(new Paragraph(new ParagraphProperties(paragraphPropertiesOuterXml), new Run(new RunProperties(runPropertiesOuterXml), new Text(field.FieldType))));
tr.Append(tc3);
TableCell tc4 = new TableCell();
tc4.Append(new Paragraph(new ParagraphProperties(paragraphPropertiesOuterXml), new Run(new RunProperties(runPropertiesOuterXml), new Text((field.Required) ? TEXT_YES : TEXT_NO))));
tr.Append(tc4);
TableCell tc5 = new TableCell();
tc5.Append(new Paragraph(new ParagraphProperties(paragraphPropertiesOuterXml), new Run(new RunProperties(runPropertiesOuterXml), new Text((field.MultiValue) ? TEXT_YES : TEXT_NO))));
tr.Append(tc5);
TableCell tc6 = new TableCell();
tc6.Append(new Paragraph(new ParagraphProperties(paragraphPropertiesOuterXml), new Run(new RunProperties(runPropertiesOuterXml), new Text(field.Properties))));
tr.Append(tc6);
table.Append(tr);
}
if (schemaData.MetadataFields.Count > 0 && schemaData.SchemaType == "Component")
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TableCellProperties tcProperties = new TableCellProperties(metaDataCellProperties.OuterXml);
GridSpan gridSpan = new GridSpan(){ Val = 6 };
tcProperties.Append(gridSpan);
tr.Append(new TableRowProperties(metaDataRowProperties.OuterXml));
tc.Append(tcProperties);
tc.Append(new Paragraph(new ParagraphProperties(metaDataParagraphProperties.OuterXml), new Run(new RunProperties(metaDataRunProperties.OuterXml), new Text(TEXT_METADATA))));
tr.Append(tc);
table.Append(tr);
}
//.........这里部分代码省略.........
示例11: WriteQuestionGroupResponse
private void WriteQuestionGroupResponse(Body body, QuestionGroupVM questionGroup)
{
ICollection<QuestionVM> questions = questionGroup.Questions;
if (questions.Count == 0)
{
return;
}
Table table = CreateFilledTable(true, true);
if (questionGroup.Orientation == QuestionGroupOrientation.Row)
{
//行方向の場合(選択肢が横に並んでいる)
QuestionVM firstQuestion = questions.First();
List<CodeVM> codes = GetValidCodes(firstQuestion.Response.Codes);
int firstQuestionCount = codes.Count;
TableRow tableRow = null;
if (questionGroup.Sentence == QuestionGroupSentence.Top)
{
//ヘッダー行
tableRow = new TableRow();
table.Append(tableRow);
tableRow.Append(CreateBorderCell(0));
foreach (CodeVM code in codes)
{
tableRow.Append(CreateBorderCell(code.Label));
}
}
foreach (QuestionVM question in questions)
{
tableRow = new TableRow();
table.Append(tableRow);
//最初に質問文
tableRow.Append(CreateBorderCell(question.Title));
//その後にセル
codes = GetValidCodes(question.Response.Codes);
foreach (CodeVM code in codes)
{
List<string> contents = new List<string>();
contents.Add(code.Value);
if (questionGroup.Sentence == QuestionGroupSentence.EachCell)
{
contents.Add(code.Label);
}
tableRow.Append(CreateCenterCell(contents));
}
int diff = firstQuestionCount - codes.Count;
if (diff > 0)
{
for (int i = 0; i < diff; i++)
{
tableRow.Append(CreateBorderCell(0));
}
}
}
}
else
{
//列方向の場合
//ヘッダー行
TableRow tableRow = new TableRow();
table.Append(tableRow);
if (questionGroup.Sentence == QuestionGroupSentence.Top)
{
tableRow.Append(CreateBorderCell(0));
}
//質問文
foreach (QuestionVM question in questions)
{
tableRow.Append(CreateBorderCell(question.Title));
}
QuestionVM firstQuestion = questions.First();
List<CodeVM> codes = GetValidCodes(firstQuestion.Response.Codes);
int firstQuestionCount = codes.Count;
int codeIndex = 0;
foreach (CodeVM code in codes)
{
tableRow = new TableRow();
table.Append(tableRow);
//選択肢
if (questionGroup.Sentence == QuestionGroupSentence.Top)
{
tableRow.Append(CreateBorderCell(code.Label));
}
foreach (QuestionVM question in questions)
{
List<CodeVM> questionCodes = GetValidCodes(question.Response.Codes);
if (codeIndex < questionCodes.Count)
{
List<string> contents = new List<string>();
contents.Add(questionCodes[codeIndex].Value);
if (questionGroup.Sentence == QuestionGroupSentence.EachCell)
//.........这里部分代码省略.........
示例12: GenerateTable
// Creates an Table instance and adds its children.
public static Table GenerateTable(Document doc, System.Data.DataTable datetable)
{
Table table = new Table();
//
PageSize pagesize = doc.Body.Descendants<PageSize>().First();
PageMargin pagemargin = doc.Body.Descendants<PageMargin>().First();
//
var AvailableSumWidth = (int)(pagesize.Width - pagemargin.Right - pagemargin.Left);
TableBorders tborder = new Func<TableBorders>(delegate()
{
TableBorders tableBorders1 = new TableBorders();
TopBorder topBorder1 = new TopBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
InsideHorizontalBorder insideHorizontalBorder1 = new InsideHorizontalBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
InsideVerticalBorder insideVerticalBorder1 = new InsideVerticalBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)0U };
tableBorders1.Append(topBorder1);
tableBorders1.Append(leftBorder1);
tableBorders1.Append(bottomBorder1);
tableBorders1.Append(rightBorder1);
tableBorders1.Append(insideHorizontalBorder1);
tableBorders1.Append(insideVerticalBorder1);
return tableBorders1;
})();
table.AppendChild<TableProperties>(new TableProperties(
new TableStyle() { Val = "a7" },
tborder,
new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto },
new TableLook() { Val = "04A0", FirstRow = true, LastRow = false, FirstColumn = true, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = true }
));
int sumColumn = datetable.Columns.Count;
int averwidth = AvailableSumWidth / sumColumn;
Double set_colSumW = 0;
int remainSumW = 0;
foreach (System.Data.DataColumn item in datetable.Columns)
{
Object col_w = item.ExtendedProperties["width"];
if (col_w != null) { set_colSumW += Convert.ToDouble(col_w); remainSumW += averwidth; }
}
foreach (System.Data.DataColumn item in datetable.Columns)
{
Object col_w = item.ExtendedProperties["width"];
if (col_w != null) item.ExtendedProperties.Add("WordWidth", Math.Floor((remainSumW * Convert.ToDouble(col_w) / set_colSumW)));
else item.ExtendedProperties.Add("WordWidth", averwidth);
}
for (int i = 0; i < sumColumn; i++)
{
int col_w = Convert.ToInt32(datetable.Columns[i].ExtendedProperties["WordWidth"]);
table.AppendChild<GridColumn>(new GridColumn() { Width = col_w.ToString() });
}
List<System.Data.DataRow> lstCol = new List<System.Data.DataRow>();
System.Data.DataRow dr = datetable.NewRow();
List<object> lstObj = new List<object>();
foreach (System.Data.DataColumn item in datetable.Columns)
{
lstObj.Add(item.ColumnName);
}
dr.ItemArray = lstObj.ToArray();
datetable.Rows.InsertAt(dr, 0);
foreach (System.Data.DataRow item in datetable.Rows)
{
TableRow tableRow = new TableRow() { RsidTableRowAddition = "00D24D12", RsidTableRowProperties = "00D24D12" };
for (int i = 0; i < sumColumn; i++)
{
int col_w = Convert.ToInt32(datetable.Columns[i].ExtendedProperties["WordWidth"]);
string cellValue = item[i].ToString();
TableCell tableCell1 = new TableCell();
TableCellProperties tableCellProperties1 = new TableCellProperties();
TableCellWidth tableCellWidth1 = new TableCellWidth() { Width = col_w.ToString(), Type = TableWidthUnitValues.Dxa };
tableCellProperties1.Append(tableCellWidth1);
Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "00D24D12", RsidParagraphProperties = "003246FB", RsidRunAdditionDefault = "00D24D12" };
Run run1 = new Run();
RunProperties runProperties1 = new RunProperties();
RunFonts runFonts1 = new RunFonts() { Hint = FontTypeHintValues.EastAsia };
runProperties1.Append(runFonts1);
Text text1 = new Text();
text1.Text = cellValue;
run1.Append(runProperties1);
run1.Append(text1);
//.........这里部分代码省略.........
示例13: AddGridRow
private TableRow AddGridRow()
{
var TR = new TableRow();
for (int i = 0; i < _grid.CountColumns; i++)
TR.Append(_grid[i, _row].XMLCell);
return TR;
}
示例14: GenerateChapterFourTable1
private void GenerateChapterFourTable1()
{
var chapterFour = (ChapterFour)_sessionObjects.ChapterFour;
var discipline = (Discipline)_additionalObjects.Discipline;
var paraProp = new ParagraphProperties();
var paragraph = new Paragraph();
var runProp = new RunProperties();
var run = new Run();
var runs = new List<Run>();
var table = new Table();
table.Append(GenerateTableProperties());
var tableGrid1 = new TableGrid();
for (var i = 0; i < chapterFour.AuditoriumHours.Columns.Count + 1; i++)
{
var gridColumn1 = new GridColumn();
if (i == 0)
{
gridColumn1.Width = "4536";
}
else
{
gridColumn1.Width = "1200";
}
tableGrid1.Append(gridColumn1);
}
table.Append(tableGrid1);
#region Шапка
#region row
var tableRow = new TableRow();
#region cell
var tableCell = new TableCell();
TableCellProperties tableCellProperties1 = new TableCellProperties();
tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
tableCell.Append(tableCellProperties1);
paragraph = new Paragraph();
paraProp = GetParagraphProperties("TableStyle");
var spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
var justification = new Justification() { Val = JustificationValues.Center };
paraProp.Append(spacingBetweenLines);
paraProp.Append(justification);
run = new Run();
runProp = new RunProperties
{
Bold = new Bold(),
Italic = new Italic()
};
run.Append(runProp);
run.Append(new Text("Вид учебной работы"));
paragraph.Append(paraProp);
paragraph.Append(run);
tableCell.Append(paragraph);
tableRow.Append(tableCell);
#endregion
#region cell
tableCell = new TableCell();
tableCellProperties1 = new TableCellProperties();
tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
tableCell.Append(tableCellProperties1);
paragraph = new Paragraph();
paraProp = GetParagraphProperties("TableStyle");
spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
justification = new Justification() { Val = JustificationValues.Center };
paraProp.Append(spacingBetweenLines);
paraProp.Append(justification);
run = new Run();
runProp = new RunProperties
{
Bold = new Bold(),
Italic = new Italic()
};
run.Append(runProp);
run.Append(new Text("Всего зачетных единиц / часов"));
paragraph.Append(paraProp);
paragraph.Append(run);
tableCell.Append(paragraph);
tableRow.Append(tableCell);
#endregion
#region cell
tableCell = new TableCell();
tableCellProperties1 = new TableCellProperties();
tableCellProperties1.Append(new VerticalMerge() { Val = MergedCellValues.Restart });
tableCellProperties1.Append(new GridSpan() { Val = 2 });
tableCellProperties1.Append(new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center });
tableCell.Append(tableCellProperties1);
paragraph = new Paragraph();
paraProp = GetParagraphProperties("TableStyle");
spacingBetweenLines = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
justification = new Justification() { Val = JustificationValues.Center };
paraProp.Append(spacingBetweenLines);
//.........这里部分代码省略.........
示例15: 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);