示例#1
0
        public void SetRowProperties(int rowIndex, int heightIn20thPoints, byte rowOutlineLevel, bool collapsed, bool autoSize)
        {
            if (rowIndex > this.MaxRows)
            {
                throw new ReportRenderingException(ExcelRenderRes.MaxRowExceededInSheet(rowIndex.ToString(CultureInfo.InvariantCulture), this.MaxRows.ToString(CultureInfo.InvariantCulture)));
            }
            double num = (double)heightIn20thPoints / 20.0;

            this._currentRow.Height       = num;
            this._currentRow.CustomHeight = !autoSize;
            if (rowOutlineLevel > 7)
            {
                rowOutlineLevel = 7;
            }
            this._currentRow.OutlineLevel     = rowOutlineLevel;
            this._currentRow.OutlineCollapsed = collapsed;
            this._currentRow.Hidden           = collapsed;
            foreach (Picture item in this._picturesStartingOnCurrentRow)
            {
                item.UpdateRowOffset(num, true);
            }
            this._picturesStartingOnCurrentRow.Clear();
            List <Picture> list = default(List <Picture>);

            if (this._picturesToUpdateByEndRow.TryGetValue(rowIndex, out list))
            {
                foreach (Picture item2 in list)
                {
                    item2.UpdateRowOffset(num, false);
                }
            }
        }
 internal void SetMimeType(string mimeType)
 {
     if (mimeType == null)
     {
         return;
     }
     if (mimeType.Equals("image/gif"))
     {
         m_imageFormat = ImageFormat.Gif;
         return;
     }
     if (mimeType.Equals("image/png"))
     {
         m_imageFormat = ImageFormat.Png;
         return;
     }
     if (mimeType.Equals("image/jpg") || mimeType.Equals("image/jpeg"))
     {
         m_imageFormat = ImageFormat.Jpeg;
         return;
     }
     if (mimeType.Equals("image/bmp"))
     {
         m_imageFormat = ImageFormat.Png;
         return;
     }
     throw new ReportRenderingException(ExcelRenderRes.UnknownImageFormat(mimeType));
 }
示例#3
0
        public void SetColumnProperties(int columnIndex, double widthInPoints, byte columnOutlineLevel, bool collapsed)
        {
            if (columnIndex > this.MaxColumns)
            {
                throw new ReportRenderingException(ExcelRenderRes.MaxColExceededInSheet(columnIndex.ToString(CultureInfo.InvariantCulture), this.MaxColumns.ToString(CultureInfo.InvariantCulture)));
            }
            ColumnProperties columnProperties = this._currentSheet.GetColumnProperties(columnIndex);

            columnProperties.Width = widthInPoints;
            if (columnOutlineLevel > 7)
            {
                columnOutlineLevel = 7;
            }
            columnProperties.OutlineLevel     = columnOutlineLevel;
            columnProperties.OutlineCollapsed = collapsed;
            columnProperties.Hidden           = collapsed;
            List <Picture> list = default(List <Picture>);

            if (this._picturesToUpdateByStartColumn.TryGetValue(columnIndex, out list))
            {
                foreach (Picture item in list)
                {
                    item.UpdateColumnOffset(widthInPoints, true);
                }
            }
            if (this._picturesToUpdateByEndColumn.TryGetValue(columnIndex, out list))
            {
                foreach (Picture item2 in list)
                {
                    item2.UpdateColumnOffset(widthInPoints, false);
                }
            }
        }
 public void SetMimeType(string mimeType)
 {
     if (mimeType != null)
     {
         if (mimeType.Equals("image/gif"))
         {
             this.m_imageFormat = ImageFormat.Gif;
         }
         else if (mimeType.Equals("image/png"))
         {
             this.m_imageFormat = ImageFormat.Png;
         }
         else
         {
             if (!mimeType.Equals("image/jpg") && !mimeType.Equals("image/jpeg"))
             {
                 if (mimeType.Equals("image/bmp"))
                 {
                     this.m_imageFormat = ImageFormat.Png;
                     return;
                 }
                 throw new ReportRenderingException(ExcelRenderRes.UnknownImageFormat(mimeType));
             }
             this.m_imageFormat = ImageFormat.Jpeg;
         }
     }
 }
示例#5
0
 internal string GetFormat(int ifmt)
 {
     if (m_formatIntMap.TryGetValue(ifmt, out int value))
     {
         return(m_formats[value].String);
     }
     throw new ReportRenderingException(ExcelRenderRes.InvalidIndexException(ifmt.ToString(CultureInfo.InvariantCulture)));
 }
示例#6
0
 public void AddRow(int rowIndex)
 {
     if (rowIndex > this.MaxRows)
     {
         throw new ReportRenderingException(ExcelRenderRes.MaxRowExceededInSheet(rowIndex.ToString(CultureInfo.InvariantCulture), this.MaxRows.ToString(CultureInfo.InvariantCulture)));
     }
     this._maxRowIndex = Math.Max(this._maxRowIndex, rowIndex);
 }
 internal static void WriteShortU(int aVal, byte[] aBuf, int aOff)
 {
     if (aVal > USHORT_MAX)
     {
         throw new IOException(ExcelRenderRes.MaxValueExceeded(USHORT_MAX.ToString(CultureInfo.InvariantCulture)));
     }
     WriteShort((short)(aVal & 0xFFFF), aBuf, aOff);
 }
 public static void WriteIntU(long aVal, byte[] aBuf, int aOff)
 {
     if (aVal > LittleEndianHelper.UINT_MAX)
     {
         throw new IOException(ExcelRenderRes.MaxValueExceeded(LittleEndianHelper.UINT_MAX.ToString(CultureInfo.InvariantCulture)));
     }
     LittleEndianHelper.WriteInt((int)(aVal & -1), aBuf, aOff);
 }
 public static void WriteShortU(int aVal, byte[] aBuf, int aOff)
 {
     if (aVal > LittleEndianHelper.USHORT_MAX)
     {
         throw new IOException(ExcelRenderRes.MaxValueExceeded(LittleEndianHelper.USHORT_MAX.ToString(CultureInfo.InvariantCulture)));
     }
     LittleEndianHelper.WriteShort((short)(aVal & 0xFFFF), aBuf, aOff);
 }
 public static void writeByteU(short aVal, byte[] aBuf, int aOff)
 {
     if (aVal > LittleEndianHelper.UBYTE_MAX)
     {
         throw new IOException(ExcelRenderRes.MaxValueExceeded(LittleEndianHelper.UBYTE_MAX.ToString(CultureInfo.InvariantCulture)));
     }
     aBuf[aOff] = (byte)(aVal & 0xFF);
 }
 internal static void WriteIntU(long aVal, byte[] aBuf, int aOff)
 {
     if (aVal > UINT_MAX)
     {
         throw new IOException(ExcelRenderRes.MaxValueExceeded(UINT_MAX.ToString(CultureInfo.InvariantCulture)));
     }
     WriteInt((int)(aVal & -1), aBuf, aOff);
 }
示例#12
0
 public void SetRowContext(int rowIndex)
 {
     this.FinalizeCell();
     if (rowIndex > this.MaxRows)
     {
         throw new ReportRenderingException(ExcelRenderRes.MaxRowExceededInSheet(rowIndex.ToString(CultureInfo.InvariantCulture), this.MaxRows.ToString(CultureInfo.InvariantCulture)));
     }
     this._currentRow = this._currentSheet.CreateRow(rowIndex);
 }
        public string GetFormat(int ifmt)
        {
            int index = default(int);

            if (this.m_formatIntMap.TryGetValue(ifmt, out index))
            {
                return(this.m_formats[index].String);
            }
            throw new ReportRenderingException(ExcelRenderRes.InvalidIndexException(ifmt.ToString(CultureInfo.InvariantCulture)));
        }
示例#14
0
        public void SetCellValue(object value, TypeCode type)
        {
            string text = value as string;

            if (text != null && text.Length > 32767)
            {
                throw new ReportRenderingException(ExcelRenderRes.MaxStringLengthExceeded(this._currentRow.RowNumber.ToString(CultureInfo.InvariantCulture), this._currentColumn.ToString(CultureInfo.InvariantCulture)));
            }
            this._currentCell.Value          = value;
            this._currentCellHasBeenModified = true;
        }
示例#15
0
 public void AddPrintTitle(int rowStart, int rowEnd)
 {
     if (rowStart < 0 || rowStart > MaxRows)
     {
         throw new ReportRenderingException(ExcelRenderRes.ValueOutOfRange(0.ToString(CultureInfo.InvariantCulture), MaxRows.ToString(CultureInfo.InvariantCulture), rowStart.ToString(CultureInfo.InvariantCulture)));
     }
     if (rowEnd < 0 || rowEnd > MaxRows)
     {
         throw new ReportRenderingException(ExcelRenderRes.ValueOutOfRange(0.ToString(CultureInfo.InvariantCulture), MaxRows.ToString(CultureInfo.InvariantCulture), rowEnd.ToString(CultureInfo.InvariantCulture)));
     }
     _currentSheet.PageSetup.SetPrintTitleToRows(rowStart, rowEnd);
 }
示例#16
0
        private TransformResult CreateRichStringRecord(RichTextInfo richTextInfo, CellRenderingDetails details)
        {
            StringWrapperBIFF8 stringWrapperBIFF = richTextInfo.CompleteRun();

            if (stringWrapperBIFF.Cch > 32767)
            {
                throw new ReportRenderingException(ExcelRenderRes.MaxStringLengthExceeded(details.Row.ToString(CultureInfo.InvariantCulture), details.Column.ToString(CultureInfo.InvariantCulture)));
            }
            int isst = this.m_stringHandler.AddString(stringWrapperBIFF);

            this.OnCellBegin(253, details.Column);
            RecordFactory.LABELSST(details.Output, (ushort)details.Row, (ushort)details.Column, details.Ixfe, (uint)isst);
            return(TransformResult.Handled);
        }
示例#17
0
 public TransformResult CreateStringRecord(string input, CellRenderingDetails details)
 {
     if (input.Length > 32767)
     {
         throw new ReportRenderingException(ExcelRenderRes.MaxStringLengthExceeded(details.Row.ToString(CultureInfo.InvariantCulture), details.Column.ToString(CultureInfo.InvariantCulture)));
     }
     if (input.Length < 256)
     {
         this.OnCellBegin(516, details.Column);
         RecordFactory.LABEL(details.Output, (ushort)details.Row, (ushort)details.Column, details.Ixfe, input.ToString());
     }
     else
     {
         int isst = this.m_stringHandler.AddString(input.ToString());
         this.OnCellBegin(253, details.Column);
         RecordFactory.LABELSST(details.Output, (ushort)details.Row, (ushort)details.Column, details.Ixfe, (uint)isst);
     }
     return(TransformResult.Handled);
 }
        public void Commit(Style cellStyle)
        {
            if (_text.Length > 32767)
            {
                throw new ReportRenderingException(ExcelRenderRes.MaxStringLengthExceeded(_row.ToString(CultureInfo.InvariantCulture), _column.ToString(CultureInfo.InvariantCulture)));
            }
            _cell.Value = _text.ToString();
            bool flag = true;

            foreach (CharacterRunFont font in _fonts)
            {
                if (font.Length > 0)
                {
                    if (flag)
                    {
                        cellStyle.Font.SetFont(font.Font);
                        flag = false;
                    }
                    _cell.GetCharacters(font.StartIndex, font.Length).Font = font.Font;
                }
            }
        }