internal RtfImage(string fileName, ImageFileType type) { _imgFname = fileName; _imgType = type; _alignment = Align.None; _margins = new Margins(); _keepAspectRatio = true; _blockHead = @"{\pard"; _blockTail = @"}"; _startNewPage = false; _startNewPara = false; Image image = Image.FromFile(fileName); _width = (image.Width / image.HorizontalResolution) * 72; _height = (image.Height / image.VerticalResolution) * 72; using (MemoryStream mStream = new MemoryStream()) { image.Save(mStream, image.RawFormat); _imgByte = mStream.ToArray(); } }
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."); } HeaderBackgroundColour = null; RowBackgroundColour = null; RowAltBackgroundColour = null; // 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); } } }