Esempio n. 1
0
        public void AddPadding(int cellIndex, byte code, object value, int defaultValue)
        {
            int twips = defaultValue;

            if (value != null)
            {
                twips = Word97Writer.ToTwips((string)value);
            }
            switch (code)
            {
            case 15:
                m_cellPadding.SetPaddingLeft(cellIndex, twips);
                break;

            case 16:
                m_cellPadding.SetPaddingRight(cellIndex, twips);
                break;

            case 17:
                m_cellPadding.SetPaddingTop(cellIndex, twips);
                break;

            case 18:
                m_cellPadding.SetPaddingBottom(cellIndex, twips);
                break;
            }
        }
Esempio n. 2
0
        internal void AddCellDiagonal(int cellIndex, RPLFormat.BorderStyles style, string width, string color, bool slantUp)
        {
            BorderCode borderCode = new BorderCode();
            byte       b          = (byte)(slantUp ? 32 : 16);

            borderCode.Ico24 = Word97Writer.ToIco24(color);
            double num = Word97Writer.ToPoints(width);

            borderCode.LineWidth = (byte)(num * 8.0);
            borderCode.Style     = ConvertBorderStyle(style);
            byte[] array = new byte[11]
            {
                (byte)cellIndex,
                (byte)(cellIndex + 1),
                b,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0
            };
            borderCode.Serialize2K3(array, 3);
            m_tapx.AddSprm(54831, 0, array);
        }
Esempio n. 3
0
 private void SetDefaultBorderWidth(string width)
 {
     for (int i = 0; i < m_tableBorders.Length; i++)
     {
         m_tableBorders[i].LineWidth = (int)(Word97Writer.ToPoints(width) * 8.0);
     }
 }
Esempio n. 4
0
 private void SetTableCellShading(int index, string color)
 {
     if (!color.Equals("Transparent"))
     {
         int ico = Word97Writer.ToIco24(color);
         m_cellShading.SetCellShading(index, ico);
     }
 }
Esempio n. 5
0
        private void SetCellBorderWidth(int cellIndex, string width)
        {
            byte lineWidth = (byte)(Word97Writer.ToPoints(width) * 8.0);

            for (int i = 0; i < m_cellBorders.Length; i++)
            {
                m_cellBorders[i].LineWidth = lineWidth;
            }
        }
Esempio n. 6
0
        private void SetDefaultBorderColor(string color)
        {
            int color2 = Word97Writer.ToIco24(color);

            for (int i = 0; i < m_tableBorders.Length; i++)
            {
                m_tableBorders[i].SetColor(color2);
            }
        }
Esempio n. 7
0
 private void SetTableShading(string color)
 {
     if (!color.Equals("Transparent"))
     {
         int val = Word97Writer.ToIco24(color);
         m_tableShd = new byte[10];
         LittleEndian.PutInt(m_tableShd, 4, val);
     }
 }
Esempio n. 8
0
        private void SetCellBorderColor(int cellIndex, string color)
        {
            int ico = Word97Writer.ToIco24(color);

            for (int i = 0; i < m_cellBorders.Length; i++)
            {
                m_cellBorders[i].Ico24 = ico;
            }
        }
        internal byte[] ToByteArray()
        {
            int num = 0;

            byte[] array = new byte[SprmSize];
            num += Word97Writer.AddSprm(array, num, 54810, 0, m_borderColorsTop);
            num += Word97Writer.AddSprm(array, num, 54811, 0, m_borderColorsLeft);
            num += Word97Writer.AddSprm(array, num, 54812, 0, m_borderColorsBottom);
            num += Word97Writer.AddSprm(array, num, 54813, 0, m_borderColorsRight);
            return(array);
        }
Esempio n. 10
0
        internal byte[] ToByteArray()
        {
            byte[] array = new byte[SprmSize];
            int    num   = 0;

            num += Word97Writer.AddSprm(array, num, 54802, 0, m_cellShading);
            if (m_cellShading2 != null)
            {
                num += Word97Writer.AddSprm(array, num, 54806, 0, m_cellShading2);
                if (m_cellShading3 != null)
                {
                    num += Word97Writer.AddSprm(array, num, 54796, 0, m_cellShading3);
                }
            }
            return(array);
        }
Esempio n. 11
0
 internal void InitTableRow(float leftStart, float rowHeight, float[] columnWidths, AutoFit autoFit)
 {
     if (m_tapx.Offset == 14)
     {
         float num = 0f;
         foreach (float num2 in columnWidths)
         {
             num += num2;
         }
         if (num / 25.4f > 22f)
         {
             RSTrace.RenderingTracer.Trace(TraceLevel.Verbose, "The maximum page width of the report exceeds 22 inches (55.88 centimeters).");
         }
         else if (columnWidths.Length > 63)
         {
             RSTrace.RenderingTracer.Trace(TraceLevel.Verbose, "The rendered report contains a table that has more than 63 columns.");
         }
         m_columnWidths = columnWidths;
         m_numColumns   = columnWidths.Length;
         m_borderColors = new CellBorderColor(m_numColumns);
         m_cellShading  = new CellShading(m_numColumns, m_tableShd);
         m_cellPadding  = new CellPadding(m_numColumns);
         CreateTableDefSprm(leftStart);
         if (autoFit != AutoFit.Never)
         {
             m_tapx.AddSprm(13845, (int)autoFit, null);
         }
         if (m_tableShd != null)
         {
             m_tapx.AddSprm(54880, 0, m_tableShd);
         }
         m_startOffset = m_tapx.Offset;
     }
     else
     {
         m_tapx.Clear(m_startOffset, m_tapx.Buf.Length - m_startOffset);
         int tcLocation = GetTcLocation(m_numColumns, 0);
         m_tapx.Clear(tcLocation, m_numColumns * 20);
         m_borderColors.Reset();
         m_cellShading.Reset();
         m_cellPadding.Reset();
         m_tapx.Reset(m_startOffset);
     }
     m_rowHeight         = Word97Writer.ToTwips(rowHeight);
     WriteExactRowHeight = false;
     WriteRowHeight      = true;
 }
Esempio n. 12
0
 internal void Write(BinaryWriter dataWriter, BinaryWriter levelWriter, Word97Writer writer)
 {
     dataWriter.Write(m_lsid);
     dataWriter.Write(m_lsid);
     for (int i = 0; i < 9; i++)
     {
         dataWriter.Write((short)4095);
     }
     dataWriter.Write((short)0);
     for (int j = 0; j < m_levels.Length; j++)
     {
         if (m_levels[j] == null)
         {
             m_levels[j] = new ListLevelOnFile(j, RPLFormat.ListStyles.Numbered, writer);
         }
         m_levels[j].Write(levelWriter);
     }
 }
Esempio n. 13
0
        private void CreateTableDefSprm(float leftStart)
        {
            int num = 1 + 2 * (m_numColumns + 1) + 20 * m_numColumns;

            byte[] array = new byte[num + 4];
            int    num2  = 0;

            LittleEndian.PutUShort(array, num2, 54792);
            num2 += 2;
            LittleEndian.PutUShort(array, num2, (ushort)(num + 1));
            num2         += 2;
            array[num2++] = (byte)m_numColumns;
            ushort num3 = Word97Writer.ToTwips(leftStart);

            if (num3 > 31680)
            {
                num3 = 31680;
            }
            LittleEndian.PutUShort(array, num2, num3);
            num2 += 2;
            for (int i = 0; i < m_numColumns; i++)
            {
                ushort num4 = Word97Writer.ToTwips(m_columnWidths[i]);
                if (num4 == 0)
                {
                    num4 = 1;
                }
                num3 = (ushort)(num3 + num4);
                if (num3 > 31680)
                {
                    num3 = 31680;
                }
                LittleEndian.PutUShort(array, num2, num3);
                num2 += 2;
            }
            m_tapx.AddRawSprmData(array);
        }
Esempio n. 14
0
        internal ListLevelOnFile(int level, RPLFormat.ListStyles listStyle, Word97Writer writer)
        {
            m_style   = listStyle;
            _iStartAt = 1;
            int num = 0;

            _grpprlPapx = new byte[0];
            _dxaSpace   = 360;
            _rgbxchNums = new byte[9];
            _dxaIndent  = 0;
            _ixchFollow = 0;
            string fontName = "Arial";

            switch (listStyle)
            {
            case RPLFormat.ListStyles.Numbered:
                _rgbxchNums[0] = 1;
                _bulletText    = new char[2]
                {
                    (char)level,
                    '.'
                };
                switch (level % 3)
                {
                case 0:
                    setNumberFormatInternal(WordNumberFormat.Arabic);
                    break;

                case 1:
                    setNumberFormatInternal(WordNumberFormat.RomanLower);
                    break;

                case 2:
                    setNumberFormatInternal(WordNumberFormat.Lowercase);
                    break;
                }
                break;

            case RPLFormat.ListStyles.Bulleted:
                setNumberFormatInternal(WordNumberFormat.Bullet);
                switch (level % 3)
                {
                case 0:
                    _bulletText = new char[1]
                    {
                        '·'
                    };
                    fontName = "Symbol";
                    break;

                case 1:
                    _bulletText = new char[1]
                    {
                        'o'
                    };
                    fontName = "Courier New";
                    break;

                case 2:
                    _bulletText = new char[1]
                    {
                        '§'
                    };
                    fontName = "Wingdings";
                    break;
                }
                break;

            default:
                setNumberFormatInternal(WordNumberFormat.Bullet);
                _bulletText = new char[1]
                {
                    ' '
                };
                break;
            }
            _grpprlChpx = new byte[20];
            num         = 0;
            int param = writer.WriteFont(fontName);

            num += Word97Writer.AddSprm(_grpprlChpx, num, 19023, param, null);
            num += Word97Writer.AddSprm(_grpprlChpx, num, 19038, param, null);
            num += Word97Writer.AddSprm(_grpprlChpx, num, 19024, param, null);
            num += Word97Writer.AddSprm(_grpprlChpx, num, 19025, param, null);
            int param2 = 20;

            num += Word97Writer.AddSprm(_grpprlChpx, num, 19011, param2, null);
        }
Esempio n. 15
0
        private void SetBorderColor(string color, Positions position)
        {
            int color2 = Word97Writer.ToIco24(color);

            m_tableBorders[(int)position].SetColor(color2);
        }
Esempio n. 16
0
 private void SetBorderWidth(string width, Positions position)
 {
     m_tableBorders[(int)position].LineWidth = (int)(Word97Writer.ToPoints(width) * 8.0);
 }
Esempio n. 17
0
        private void SetCellBorderWidth(int cellIndex, string width, Positions position)
        {
            double num = Word97Writer.ToPoints(width);

            m_cellBorders[(int)position].LineWidth = (int)(num * 8.0);
        }
Esempio n. 18
0
        private void SetCellBorderColor(int cellIndex, string color, Positions position)
        {
            int ico = Word97Writer.ToIco24(color);

            m_cellBorders[(int)position].Ico24 = ico;
        }