public void Write(TextWriter writer) { if (_hanging.HasValue || _first.HasValue || _left.HasValue || _right.HasValue) { writer.Write("<w:ind"); if (_left.HasValue) { writer.Write(" w:left=\""); writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_left.Value), -31680, 31680)); writer.Write("\""); } if (_right.HasValue) { writer.Write(" w:right=\""); writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_right.Value), -31680, 31680)); writer.Write("\""); } if (_hanging.HasValue) { writer.Write(" w:hanging=\""); writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_hanging.Value), 0, 31680)); writer.Write("\""); } if (_first.HasValue) { writer.Write(" w:firstLine=\""); writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_first.Value), 0, 31680)); writer.Write("\""); } writer.Write("/>"); } }
public override void Write(TextWriter output) { output.Write("<w:trPr>"); if (this._rowIndent > 0.0) { output.Write("<w:wBefore w:w=\""); output.Write(WordOpenXmlUtils.ToTwips(this._rowIndent, 0f, 31680f)); output.Write("\" w:type=\"dxa\"/>"); } long num = (long)WordOpenXmlUtils.ToTwips(this._height) - (long)WordOpenXmlUtils.PointsToTwips((double)this._maxPaddingTop, 0.0, 31680.0) - WordOpenXmlUtils.PointsToTwips((double)this._maxPaddingBottom, 0.0, 31680.0); if (!this._ignoreRowHeight && num > 0) { output.Write("<w:trHeight w:val=\""); output.Write(WordOpenXmlUtils.TwipsToString(num, 0, 31680)); output.Write(this._exactRowHeight ? "\" w:hRule=\"exact\"/>" : "\" w:hRule=\"atLeast\"/>"); } output.Write("</w:trPr>"); bool flag = this._borderTop != null || this._borderBottom != null || this._borderLeft != null || this._borderRight != null; if (flag || this._bgColor != null) { output.Write("<w:tblPrEx>"); } if (flag) { output.Write("<w:tblBorders>"); if (this._borderTop != null) { this._borderTop.Write(output, "top"); } if (this._borderLeft != null) { this._borderLeft.Write(output, "left"); } if (this._borderBottom != null) { this._borderBottom.Write(output, "bottom"); } if (this._borderRight != null) { this._borderRight.Write(output, "right"); } output.Write("</w:tblBorders>"); } if (this._bgColor != null) { output.Write("<w:shd w:val=\"clear\" w:fill=\""); output.Write(this._bgColor); output.Write("\"/>"); } if (!flag && this._bgColor == null) { return; } output.Write("</w:tblPrEx>"); }
public void Write(TextWriter writer) { writer.Write("<w:pPr>"); if (_listLevel.HasValue || _listStyleId.HasValue) { writer.Write("<w:numPr>"); if (_listLevel.HasValue) { writer.Write("<w:ilvl w:val=\""); writer.Write(_listLevel); writer.Write("\"/>"); } if (_listStyleId.HasValue) { writer.Write("<w:numId w:val=\""); writer.Write(_listStyleId); writer.Write("\"/>"); } writer.Write("</w:numPr>"); } if (RightToLeft) { writer.Write("<w:bidi/>"); } writer.Write("<w:spacing "); if (_pointsBefore.HasValue) { writer.Write("w:before=\""); writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_pointsBefore.Value), 0, 31680)); writer.Write("\" "); } writer.Write("w:after=\""); writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(PointsAfter), 0, 31680)); writer.Write("\" w:line=\""); writer.Write(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(_lineHeight), 0, 31680)); writer.Write(_lineSpacingAtLeast ? "\" w:lineRule=\"atLeast\"/>" : "\" w:lineRule=\"auto\"/>"); _indentation.Write(writer); if (_horizontalAlignment.HasValue) { switch (_horizontalAlignment.Value) { case HorizontalAlignment.Center: writer.Write("<w:jc w:val=\"center\"/>"); break; case HorizontalAlignment.Left: writer.Write("<w:jc w:val=\"left\"/>"); break; case HorizontalAlignment.Right: writer.Write("<w:jc w:val=\"right\"/>"); break; } } writer.Write("</w:pPr>"); }
public override void Write(TextWriter output) { output.Write("<w:tblGrid>"); foreach (int column in _columns) { output.Write("<w:gridCol w:w=\""); output.Write(WordOpenXmlUtils.TwipsToString(column, 0, 31680)); output.Write("\"/>"); } output.Write("</w:tblGrid>"); }
private string CellPadding(double points) { return(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(points), 0, 31680)); }
public void Write(TextWriter output) { output.Write("<w:tcPr>"); output.Write("<w:tcW w:w=\""); output.Write(WordOpenXmlUtils.TwipsToString(this._width, 0, 31680)); output.Write("\" w:type=\"dxa\"/>"); if (this._horizontalMerge == MergeState.Start) { output.Write("<w:hMerge w:val=\"restart\"/>"); } else if (this._horizontalMerge == MergeState.Continue) { output.Write("<w:hMerge w:val=\"continue\"/>"); } if (this._verticalMerge == MergeState.Start) { output.Write("<w:vMerge w:val=\"restart\"/>"); } else if (this._verticalMerge == MergeState.Continue) { output.Write("<w:vMerge w:val=\"continue\"/>"); } if (this._borderTop != null || this._borderBottom != null || this._borderLeft != null || this._borderRight != null || this._borderDiagonalUp != null || this._borderDiagonalDown != null) { output.Write("<w:tcBorders>"); if (this._borderTop != null) { this._borderTop.Write(output, "top"); } if (this._borderLeft != null) { this._borderLeft.Write(output, "left"); } if (this._borderBottom != null) { this._borderBottom.Write(output, "bottom"); } if (this._borderRight != null) { this._borderRight.Write(output, "right"); } if (this._borderDiagonalDown != null) { this._borderDiagonalDown.Write(output, "tl2br"); } if (this._borderDiagonalUp != null) { this._borderDiagonalUp.Write(output, "tr2bl"); } output.Write("</w:tcBorders>"); } if (this._bgColor != null) { output.Write("<w:shd w:val=\"clear\" w:fill=\""); output.Write(this._bgColor); output.Write("\"/>"); } this.WritePadding(output); if (this._textOrientation == TextOrientationEnum.Rotate90) { output.Write("<w:textDirection w:val=\"tbRlV\"/>"); } else if (this._textOrientation == TextOrientationEnum.Rotate270) { output.Write("<w:textDirection w:val=\"btLr\"/>"); } if (this._verticalAlignment == VerticalAlign.Bottom) { output.Write("<w:vAlign w:val=\"bottom\"/>"); } else if (this._verticalAlignment == VerticalAlign.Middle) { output.Write("<w:vAlign w:val=\"center\"/>"); } output.Write("</w:tcPr>"); }