private static Word.StyleTableCellProperties GetCellProperties(TableCell cell) { Word.StyleTableCellProperties cellProps = new Word.StyleTableCellProperties(); Word.TableCellVerticalAlignment vAlign = new Word.TableCellVerticalAlignment(); switch (cell.VerticalAlignment) { case VerticalAlignment.Top: vAlign.Val = Word.TableVerticalAlignmentValues.Top; break; case VerticalAlignment.Center: vAlign.Val = Word.TableVerticalAlignmentValues.Center; break; case VerticalAlignment.Bottom: vAlign.Val = Word.TableVerticalAlignmentValues.Bottom; break; default: break; } cellProps.Append(vAlign); return cellProps; }
private Wordprocessing.Table doptable(Wordprocessing.Table table) { //Строка подпись декана Wordprocessing.TableRow tableRow2 = new Wordprocessing.TableRow() { RsidTableRowAddition = "00FF67BF", RsidTableRowProperties = "008E2483" }; Wordprocessing.TableCell tableCell = new Wordprocessing.TableCell(); Wordprocessing.TableCellProperties tableCellProperties = new Wordprocessing.TableCellProperties(); Wordprocessing.TableCellWidth tableCellWidth = new Wordprocessing.TableCellWidth() { Width = "0", Type = Wordprocessing.TableWidthUnitValues.Auto }; Wordprocessing.GridSpan gridSpan = new Wordprocessing.GridSpan() { Val = 6 }; Wordprocessing.TableCellVerticalAlignment tableCellVerticalAlignment = new Wordprocessing.TableCellVerticalAlignment() { Val = Wordprocessing.TableVerticalAlignmentValues.Center }; tableCellProperties.Append(tableCellWidth); tableCellProperties.Append(gridSpan); tableCellProperties.Append(tableCellVerticalAlignment); Wordprocessing.Paragraph paragraph = new Wordprocessing.Paragraph(); Wordprocessing.ParagraphProperties parprop = new Wordprocessing.ParagraphProperties(); Wordprocessing.SpacingBetweenLines spacingBetweenLines2 = new Wordprocessing.SpacingBetweenLines() { After = "0" }; parprop.Append(spacingBetweenLines2); paragraph.Append(parprop); Wordprocessing.Run run = new Wordprocessing.Run(); Wordprocessing.Text text = new Wordprocessing.Text(); text.Text = "Подпись декана"; run.Append(text); paragraph.Append(run); tableCell.Append(tableCellProperties); tableCell.Append(paragraph); tableRow2.Append(tableCell); table.Append(tableRow2); return table; }