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>"); }
private string CellPadding(double points) { return(WordOpenXmlUtils.TwipsToString(WordOpenXmlUtils.PointsToTwips(points), 0, 31680)); }