public RtfTable(int rowCount, int colCount, float horizontalWidth, float fontSize) { _fontSize = fontSize; _alignment = Align.None; _margins = new Margins(); _rowCount = rowCount; _colCount = colCount; _representativeList = new List<RtfTableCell>(); _startNewPage = false; _titleRowCount = 0; _cellPadding = new Margins[_rowCount]; if (_rowCount < 1 || _colCount < 1) { throw new Exception("The number of rows or columns is less than 1."); } // Set cell default width according to paper width _defaultCellWidth = horizontalWidth / (float)colCount; _cells = new RtfTableCell[_rowCount][]; _rowHeight = new float[_rowCount]; _rowKeepInSamePage = new bool[_rowCount]; for (int i = 0; i < _rowCount; i++) { _cells[i] = new RtfTableCell[_colCount]; _rowHeight[i] = 0F; _rowKeepInSamePage[i] = false; _cellPadding[i] = new Margins(); for (int j = 0; j < _colCount; j++) { _cells[i][j] = new RtfTableCell(_defaultCellWidth, i, j, this); } } }
internal RtfSection(SectionStartEnd startEnd, RtfDocument doc) { ParentDocument = doc; _align = Align.None; PageOrientation = PaperOrientation.Portrait; StartEnd = startEnd; FooterPositionFromPageBottom = 720; _sectionFooter = null; _margins = new Margins(); }
internal RtfImage(string fileName, ImageFileType type) { _imgFname = fileName; _imgType = type; _alignment = Align.None; _margins = new Margins(); _keepAspectRatio = true; _blockHead = @"{\pard"; _blockTail = @"\par}"; _startNewPage = false; Image image = Image.FromFile(fileName); _width = (image.Width / image.HorizontalResolution) * 72; _height = (image.Height / image.VerticalResolution) * 72; }
public RtfParagraph(bool allowFootnote, bool allowControlWord) { _text = new StringBuilder(); _linespacing = -1; _margins = new Margins(); _align = Align.None; _charFormats = new List<RtfCharFormat>(); _allowFootnote = allowFootnote; _allowControlWord = allowControlWord; _footnotes = new List<RtfFootnote>(); _controlWords = new List<RtfFieldControlWord>(); _blockHead = @"{\pard"; _blockTail = @"\par}"; _startNewPage = false; _firstLineIndent = 0; _defaultCharFormat = null; }
public RtfDocument(PaperSize paper, PaperOrientation orientation, Lcid lcid) { _paper = paper; _orientation = orientation; _margins = new Margins(); if (_orientation == PaperOrientation.Portrait) { _margins[Direction.Top] = DefaultValue.MarginSmall; _margins[Direction.Right] = DefaultValue.MarginLarge; _margins[Direction.Bottom] = DefaultValue.MarginSmall; _margins[Direction.Left] = DefaultValue.MarginLarge; } else { // landscape _margins[Direction.Top] = DefaultValue.MarginLarge; _margins[Direction.Right] = DefaultValue.MarginSmall; _margins[Direction.Bottom] = DefaultValue.MarginLarge; _margins[Direction.Left] = DefaultValue.MarginSmall; } _lcid = lcid; _fontTable = new List<string>(); _fontTable.Add(DefaultValue.Font); // default font _colorTable = new List<Color>(); _colorTable.Add(new Color()); // default color _header = null; _footer = null; }
internal RtfImage(string url, string fileName, ImageFileType type) { Image img1; HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url); using (HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse()) { using (Stream stream = httpWebReponse.GetResponseStream()) { img = Image.FromStream(stream); } } _imgFname = fileName; _imgType = type; _alignment = Align.None; _margins = new Margins(); _keepAspectRatio = true; _blockHead = @"{\pard"; _blockTail = @"\par}"; _startNewPage = false; _width = (img.Width / img.HorizontalResolution) * 72; _height = (img.Height / img.VerticalResolution) * 72; img1 = img; }
public bool equals( Margins margins ) { return ( margins._margins[(int) Direction.Bottom] == _margins[(int) Direction.Bottom] ) && ( margins._margins[(int) Direction.Left] == _margins[(int) Direction.Left] ) && ( margins._margins[(int) Direction.Right] == _margins[(int) Direction.Right] ) && ( margins._margins[(int) Direction.Top] == _margins[(int) Direction.Top] ); }