internal OpenXmlSdkText(OpenXmlSdkRange range, OpenXmlSdk.Text text) : base(range.TextDocument, text) { if (range == null) { throw new ArgumentNullException("range"); } _range = range; }
internal OpenXmlSdkRange(OpenXmlSdkParagraph paragraph, OpenXmlSdk.Run run) : base(paragraph.TextDocument, run) { if (paragraph == null) { throw new ArgumentNullException("paragraph"); } _paragraph = paragraph; _textCollection = new OpenXmlSdkTextCollection(this); }
private Wordprocessing.Table doptable2(Wordprocessing.Table table) { for (int i = 1; i <= 5; i++) { //Первый столбец Wordprocessing.TableRow tableRow = new Wordprocessing.TableRow(); Wordprocessing.TableCell tableCell1 = new Wordprocessing.TableCell(); Wordprocessing.TableCellProperties tableCellProperties1 = new Wordprocessing.TableCellProperties(); Wordprocessing.TableCellWidth tableCellWidth1 = new Wordprocessing.TableCellWidth() { Width = "0", Type = Wordprocessing.TableWidthUnitValues.Auto }; Wordprocessing.GridSpan gridSpan1 = new Wordprocessing.GridSpan() { Val = 3 }; Wordprocessing.VerticalMerge verticalMerge1; if (i==1) verticalMerge1 = new Wordprocessing.VerticalMerge() { Val = Wordprocessing.MergedCellValues.Restart }; else verticalMerge1 = new Wordprocessing.VerticalMerge(); tableCellProperties1.Append(tableCellWidth1); tableCellProperties1.Append(gridSpan1); tableCellProperties1.Append(verticalMerge1); tableCell1.Append(tableCellProperties1); if (i == 1) { for (int j=1; j<5; j++) tableCell1.Append(retText(j, 1)); } else tableCell1.Append(retText(i, 1)); tableRow.Append(tableCell1); //Второй столбец Wordprocessing.TableCell tableCell2 = new Wordprocessing.TableCell(); Wordprocessing.TableCellProperties tableCellProperties2 = new Wordprocessing.TableCellProperties(); Wordprocessing.TableCellWidth tableCellWidth2 = new Wordprocessing.TableCellWidth() { Width = "0", Type = Wordprocessing.TableWidthUnitValues.Auto }; Wordprocessing.VerticalMerge verticalMerge2; if (i == 1) verticalMerge2 = new Wordprocessing.VerticalMerge() { Val = Wordprocessing.MergedCellValues.Restart }; else verticalMerge2 = new Wordprocessing.VerticalMerge(); tableCellProperties2.Append(tableCellWidth2); tableCellProperties2.Append(verticalMerge2); tableCell2.Append(tableCellProperties2); tableCell2.Append(retText(i, 2)); tableRow.Append(tableCell2); for (int j = 0; j < 2; j++) { Wordprocessing.TableCell tableCell3 = new Wordprocessing.TableCell(); Wordprocessing.TableCellProperties tableCellProperties3 = new Wordprocessing.TableCellProperties(); Wordprocessing.TableCellWidth tableCellWidth3 = new Wordprocessing.TableCellWidth() { Width = "0", Type = Wordprocessing.TableWidthUnitValues.Auto }; tableCellProperties3.Append(tableCellWidth3); tableCell3.Append(tableCellProperties3); tableCell3.Append(retText(i, j + 3)); tableRow.Append(tableCell3); } table.Append(tableRow); } Wordprocessing.TableRow tableRowrlast = new Wordprocessing.TableRow(); Wordprocessing.TableCell tableCellrlast = new Wordprocessing.TableCell(); Wordprocessing.TableCellProperties tableCellPropertiesrlast = new Wordprocessing.TableCellProperties(); Wordprocessing.TableCellWidth tableCellWidthrlast = new Wordprocessing.TableCellWidth() { Width = "0", Type = Wordprocessing.TableWidthUnitValues.Auto }; Wordprocessing.GridSpan gridSpanrlast = new Wordprocessing.GridSpan() { Val = 3 }; Wordprocessing.VerticalMerge verticalMergerlast = new Wordprocessing.VerticalMerge(); tableCellPropertiesrlast.Append(tableCellWidthrlast); tableCellPropertiesrlast.Append(gridSpanrlast); tableCellPropertiesrlast.Append(verticalMergerlast); tableCellrlast.Append(tableCellPropertiesrlast); tableCellrlast.Append(retText(-1, -1)); Wordprocessing.TableCell tableCellrlast1 = new Wordprocessing.TableCell(); Wordprocessing.TableCellProperties tableCellPropertiesrlast1 = new Wordprocessing.TableCellProperties(); Wordprocessing.TableCellWidth tableCellWidthrlast1 = new Wordprocessing.TableCellWidth() { Width = "0", Type = Wordprocessing.TableWidthUnitValues.Auto }; Wordprocessing.GridSpan gridSpanrlast1 = new Wordprocessing.GridSpan() { Val = 3 }; tableCellPropertiesrlast1.Append(tableCellWidthrlast1); tableCellPropertiesrlast1.Append(gridSpanrlast1); tableCellrlast1.Append(tableCellPropertiesrlast1); tableCellrlast1.Append(retText(0, 0)); tableRowrlast.Append(tableCellrlast); tableRowrlast.Append(tableCellrlast1); table.Append(tableRowrlast); return table; }
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; }
public void TableToWord(Wordprocessing.Table table, WordprocessingDocument document) { Wordprocessing.Body body = new Wordprocessing.Body(); Wordprocessing.Paragraph paragraph = new Wordprocessing.Paragraph(); body.Append(table); body.Append(paragraph); document.MainDocumentPart.Document.AppendChild(body); document.MainDocumentPart.Document.Save(); document.Close(); }
public SideBorder(w.BorderValues style, Color color, Unit size) { this.style = style; this.color = color; this.size = size; }
private string ReadTableCell(WordDoc.TableRow tr, int column, out int tableCellFontSize) { tableCellFontSize = 0; string cellFontSize = ""; int tcellFontSize = 0; StringBuilder sb = new StringBuilder(); WordDoc.TableCell tc = tr.Elements<WordDoc.TableCell>().ElementAt(column); if (tc.Elements<WordDoc.Paragraph>().First() != null) { foreach (WordDoc.Paragraph tcp in tc.Elements<WordDoc.Paragraph>()) { //Check for bullets WordDoc.ParagraphProperties pp = tcp.Elements<WordDoc.ParagraphProperties>().First(); if (pp.NumberingProperties != null) { //LogText(pp.NumberingProperties.NumberingLevelReference.Val.ToString(), true); //LogText(pp.NumberingProperties.NumberingId.Val.ToString(), true); } if (tcp.Elements<WordDoc.Run>().FirstOrDefault() != null) { foreach (WordDoc.Run tcpr in tcp.Elements<WordDoc.Run>()) { WordDoc.RunProperties tcprp = tcpr.RunProperties; if (tcprp.FontSize != null) { cellFontSize = tcprp.FontSize.Val.ToString(); } else { cellFontSize = "0"; } tcellFontSize = Convert.ToInt32(cellFontSize); if (tcpr.Elements<WordDoc.Text>().FirstOrDefault() != null) { foreach (WordDoc.Text tcprt in tcpr.Elements<WordDoc.Text>()) { sb.Append(tcprt.Text); } } } } sb.Append(Environment.NewLine); } } tableCellFontSize = tcellFontSize; return sb.ToString().Trim(); }
internal OpenXmlSdkParagraph(OpenXmlSdkTextDocument textDocument, OpenXmlSdk.Paragraph paragraph) : base(textDocument, paragraph) { _rangeCollection = new OpenXmlSdkRangeCollection(this); }