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: this.m_cellPadding.SetPaddingLeft(cellIndex, twips); break; case 16: this.m_cellPadding.SetPaddingRight(cellIndex, twips); break; case 17: this.m_cellPadding.SetPaddingTop(cellIndex, twips); break; case 18: this.m_cellPadding.SetPaddingBottom(cellIndex, twips); break; } }
private void SetDefaultBorderWidth(string width) { for (int i = 0; i < this.m_tableBorders.Length; i++) { this.m_tableBorders[i].LineWidth = (int)(Word97Writer.ToPoints(width) * 8.0); } }
public 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 = this.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); this.m_tapx.AddSprm(54831, 0, array); }
public void SetPageDimensions(float pageHeight, float pageWidth, float leftMargin, float rightMargin, float topMargin, float bottomMargin) { if (pageWidth > 558.79998779296875) { RSTrace.RenderingTracer.Trace(TraceLevel.Verbose, "The maximum page width exceeded:{0}", pageWidth); pageWidth = 558.8f; } if (Word97Writer.FixMargins(pageHeight, ref topMargin, ref bottomMargin)) { RSTrace.RenderingTracer.Trace(TraceLevel.Verbose, "The top or bottom margin is either <0 or the sum exceeds the page height."); } if (pageHeight > 558.79998779296875) { RSTrace.RenderingTracer.Trace(TraceLevel.Verbose, "The maximum page height exceeded:{0}", pageHeight); pageHeight = 558.8f; } this.m_secFormat.AddSprm(45088, Word97Writer.ToTwips(pageHeight), null); this.m_secFormat.AddSprm(45087, Word97Writer.ToTwips(pageWidth), null); this.m_secFormat.AddSprm(45089, Word97Writer.ToTwips(leftMargin), null); this.m_secFormat.AddSprm(45090, Word97Writer.ToTwips(rightMargin), null); this.m_secFormat.AddSprm(36899, Word97Writer.ToTwips(topMargin), null); this.m_secFormat.AddSprm(36900, Word97Writer.ToTwips(bottomMargin), null); if (pageWidth > pageHeight) { this.m_secFormat.AddSprm(12317, 2, null); } this.m_secFormat.AddSprm(45079, 0, null); this.m_secFormat.AddSprm(45080, 0, null); }
public void AddImage(byte[] imgBuf, float height, float width, RPLFormat.Sizings sizing) { if (imgBuf == null || imgBuf.Length == 0) { sizing = RPLFormat.Sizings.Clip; imgBuf = PictureDescriptor.INVALIDIMAGEDATA; } OfficeImageHasher officeImageHasher = new OfficeImageHasher(imgBuf); byte[] hash = officeImageHasher.Hash; int num = Word97Writer.ToTwips(height); int num2 = Word97Writer.ToTwips(width); int num3 = (int)this.m_dataStream.Position; ImageHash key = new ImageHash(hash, sizing, num2, num); if (this.m_images.ContainsKey(key)) { num3 = this.m_images[key]; } else { PictureDescriptor pictureDescriptor = new PictureDescriptor(imgBuf, hash, num2, num, sizing, this.m_imgIndex); pictureDescriptor.Serialize(this.m_dataStream); this.m_imgIndex++; this.m_images.Add(key, num3); } this.m_charFormat.SetIsInlineImage(num3); this.WriteSpecialText("\u0001"); }
private void RenderLineHeight(string size) { RPLReportSize rPLReportSize = new RPLReportSize(size); int param = Word97Writer.ToTwips((float)rPLReportSize.ToMillimeters()); this.m_parFormat.AddSprm(25618, param, null); }
public static ushort ToTwips(object size) { if (size == null) { return(0); } return(Word97Writer.ToTwips(size as string)); }
private void SetTableCellShading(int index, string color) { if (!color.Equals("Transparent")) { int ico = Word97Writer.ToIco24(color); this.m_cellShading.SetCellShading(index, ico); } }
private void SetTableShading(string color) { if (!color.Equals("Transparent")) { int val = Word97Writer.ToIco24(color); this.m_tableShd = new byte[10]; LittleEndian.PutInt(this.m_tableShd, 4, val); } }
private void SetCellBorderColor(int cellIndex, string color) { int ico = Word97Writer.ToIco24(color); for (int i = 0; i < this.m_cellBorders.Length; i++) { this.m_cellBorders[i].Ico24 = ico; } }
private void SetDefaultBorderColor(string color) { int color2 = Word97Writer.ToIco24(color); for (int i = 0; i < this.m_tableBorders.Length; i++) { this.m_tableBorders[i].SetColor(color2); } }
private void SetCellBorderWidth(int cellIndex, string width) { double num = Word97Writer.ToPoints(width); byte lineWidth = (byte)(num * 8.0); for (int i = 0; i < this.m_cellBorders.Length; i++) { this.m_cellBorders[i].LineWidth = lineWidth; } }
public byte[] ToByteArray() { int num = 0; byte[] array = new byte[this.SprmSize]; num += Word97Writer.AddSprm(array, num, 54810, 0, this.m_borderColorsTop); num += Word97Writer.AddSprm(array, num, 54811, 0, this.m_borderColorsLeft); num += Word97Writer.AddSprm(array, num, 54812, 0, this.m_borderColorsBottom); num += Word97Writer.AddSprm(array, num, 54813, 0, this.m_borderColorsRight); return(array); }
public byte[] ToByteArray() { byte[] array = new byte[this.SprmSize]; int num = 0; num += Word97Writer.AddSprm(array, num, 54802, 0, this.m_cellShading); if (this.m_cellShading2 != null) { num += Word97Writer.AddSprm(array, num, 54806, 0, this.m_cellShading2); if (this.m_cellShading3 != null) { num += Word97Writer.AddSprm(array, num, 54796, 0, this.m_cellShading3); } } return(array); }
public void InitTableRow(float leftStart, float rowHeight, float[] columnWidths, AutoFit autoFit) { if (this.m_tapx.Offset == 14) { float num = 0f; foreach (float num2 in columnWidths) { num += num2; } if (num / 25.399999618530273 > 22.0) { 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."); } this.m_columnWidths = columnWidths; this.m_numColumns = columnWidths.Length; this.m_borderColors = new CellBorderColor(this.m_numColumns); this.m_cellShading = new CellShading(this.m_numColumns, this.m_tableShd); this.m_cellPadding = new CellPadding(this.m_numColumns); this.CreateTableDefSprm(leftStart); if (autoFit != AutoFit.Never) { this.m_tapx.AddSprm(13845, (int)autoFit, null); } if (this.m_tableShd != null) { this.m_tapx.AddSprm(54880, 0, this.m_tableShd); } this.m_startOffset = this.m_tapx.Offset; } else { this.m_tapx.Clear(this.m_startOffset, this.m_tapx.Buf.Length - this.m_startOffset); int tcLocation = this.GetTcLocation(this.m_numColumns, 0); this.m_tapx.Clear(tcLocation, this.m_numColumns * 20); this.m_borderColors.Reset(); this.m_cellShading.Reset(); this.m_cellPadding.Reset(); this.m_tapx.Reset(this.m_startOffset); } this.m_rowHeight = Word97Writer.ToTwips(rowHeight); this.WriteExactRowHeight = false; this.WriteRowHeight = true; }
public void Write(BinaryWriter dataWriter, BinaryWriter levelWriter, Word97Writer writer) { dataWriter.Write(this.m_lsid); dataWriter.Write(this.m_lsid); for (int i = 0; i < 9; i++) { dataWriter.Write((short)4095); } dataWriter.Write((short)0); for (int j = 0; j < this.m_levels.Length; j++) { if (this.m_levels[j] == null) { this.m_levels[j] = new ListLevelOnFile(j, RPLFormat.ListStyles.Numbered, writer); } this.m_levels[j].Write(levelWriter); } }
private void CreateTableDefSprm(float leftStart) { int num = 1 + 2 * (this.m_numColumns + 1) + 20 * this.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)this.m_numColumns; ushort num4 = Word97Writer.ToTwips(leftStart); if (num4 > 31680) { num4 = 31680; } LittleEndian.PutUShort(array, num2, num4); num2 += 2; for (int i = 0; i < this.m_numColumns; i++) { ushort num5 = Word97Writer.ToTwips(this.m_columnWidths[i]); if (num5 == 0) { num5 = 1; } num4 = (ushort)(num4 + num5); if (num4 > 31680) { num4 = 31680; } LittleEndian.PutUShort(array, num2, num4); num2 += 2; } this.m_tapx.AddRawSprmData(array); }
public ListLevelOnFile(int level, RPLFormat.ListStyles listStyle, Word97Writer writer) { this.m_style = listStyle; this._iStartAt = 1; int num = 0; this._grpprlPapx = new byte[0]; this._dxaSpace = 360; this._rgbxchNums = new byte[9]; this._dxaIndent = 0; this._ixchFollow = 0; string fontName = "Arial"; switch (listStyle) { case RPLFormat.ListStyles.Numbered: this._rgbxchNums[0] = 1; this._bulletText = new char[2] { (char)(ushort)level, '.' }; switch (level % 3) { case 0: this.setNumberFormatInternal(WordNumberFormat.Arabic); break; case 1: this.setNumberFormatInternal(WordNumberFormat.RomanLower); break; case 2: this.setNumberFormatInternal(WordNumberFormat.Lowercase); break; } break; case RPLFormat.ListStyles.Bulleted: this.setNumberFormatInternal(WordNumberFormat.Bullet); switch (level % 3) { case 0: this._bulletText = new char[1] { '·' }; fontName = "Symbol"; break; case 1: this._bulletText = new char[1] { 'o' }; fontName = "Courier New"; break; case 2: this._bulletText = new char[1] { '§' }; fontName = "Wingdings"; break; } break; default: this.setNumberFormatInternal(WordNumberFormat.Bullet); this._bulletText = new char[1] { ' ' }; break; } this._grpprlChpx = new byte[20]; num = 0; int param = writer.WriteFont(fontName); num += Word97Writer.AddSprm(this._grpprlChpx, num, 19023, param, null); num += Word97Writer.AddSprm(this._grpprlChpx, num, 19038, param, null); num += Word97Writer.AddSprm(this._grpprlChpx, num, 19024, param, null); num += Word97Writer.AddSprm(this._grpprlChpx, num, 19025, param, null); int param2 = 20; num += Word97Writer.AddSprm(this._grpprlChpx, num, 19011, param2, null); }
private void SetCellBorderWidth(int cellIndex, string width, Positions position) { double num = Word97Writer.ToPoints(width); this.m_cellBorders[(int)position].LineWidth = (int)(num * 8.0); }
private void SetBorderColor(string color, Positions position) { int color2 = Word97Writer.ToIco24(color); this.m_tableBorders[(int)position].SetColor(color2); }
private void SetCellBorderColor(int cellIndex, string color, Positions position) { int ico = Word97Writer.ToIco24(color); this.m_cellBorders[(int)position].Ico24 = ico; }
private void SetBorderWidth(string width, Positions position) { this.m_tableBorders[(int)position].LineWidth = (int)(Word97Writer.ToPoints(width) * 8.0); }