Ejemplo n.º 1
0
        internal RtfImage(System.IO.MemoryStream imageStream)
        {
            _alignment       = Align.Left;
            _margins         = new Margins();
            _keepAspectRatio = true;
            _blockHead       = @"{\pard";
            _blockTail       = @"}";
            _startNewPage    = false;
            _startNewPara    = false;

            _imgByte = imageStream.ToArray();

            // TODO:
            //Image image = Image.FromStream(imageStream);
            //_width = (image.Width / image.HorizontalResolution) * 72;
            //_height = (image.Height / image.VerticalResolution) * 72;

            //if(image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png)) _imgType = ImageFileType.Png;
            //else if (image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Jpeg)) _imgType = ImageFileType.Jpg;
            //else if (image.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif)) _imgType = ImageFileType.Gif;
            //else throw new Exception("Image format is not supported: " + image.RawFormat.ToString());
        }
Ejemplo n.º 2
0
        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;

            // TODO:
            //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();
            //}
        }
Ejemplo n.º 3
0
        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);
                }
            }
        }