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; } }
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; }
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); }