123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Runtime.InteropServices;
- using Biff8Excel.Interfaces;
- namespace Biff8Excel.Records
- {
- [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
- struct RecordRow
- {
- public ushort opcode;
- public ushort length;
- public ushort rownumber;
- public ushort firstcol;
- public ushort lastcol;
- public ushort height;
- public ushort zeronotused;
- public ushort notused;
- [MarshalAs(UnmanagedType.U1, SizeConst = 1)]public byte optionflags1; // hidden, badFontHeight, xf flag
- [MarshalAs(UnmanagedType.U1, SizeConst = 1)]public byte optionflags2; //Alawys 0x1
- public ushort optionflags3; //has xf style
- }
- internal class Row : IRecords
- {
- RecordRow row;
- byte m_RowHidden;
- byte m_RowFontNoMatch;
- byte m_RowExplicitFormat;
- ushort m_XFIndex;
- ushort m_SpaceAbove;
- ushort m_SpaceBelow;
- const int TwipsPerPixelY = 15;
- public Row()
- {
- row.opcode = 0x208;
- row.length = 0x10;
- row.height = (ushort)(row.height | 0x8000); //flag for default height
- row.zeronotused = 0x0;
- row.notused = 0x0;
- }
- public ushort ID
- {
- get { return row.opcode; }
- }
- public ushort RecordSize
- {
- get { return 20; }
- }
- public ushort RowNumber
- {
- set { row.rownumber = value; }
- }
- public ushort FirstColumnNumber
- {
- set { row.firstcol = value; }
- get { return row.firstcol;}
- }
- public ushort LastColumnNumber
- {
- set { row.lastcol = value; }
- get { return row.lastcol; }
- }
- public bool Hidden
- {
- set { m_RowHidden = (byte)(value ? 0x20 : 0x0); }
- }
- public ushort HeightInPoints
- {
- set
- {
- // field_4_height = vData * Screen.TwipsPerPixelY
- row.height = (ushort)(value * TwipsPerPixelY);
- m_RowFontNoMatch = 0x40;
- }
- get { return (ushort)(row.height / TwipsPerPixelY); }
- }
- public ushort ExtendedFormatIndex
- {
- set {
- m_XFIndex = value;
- m_RowExplicitFormat = (byte)(value > 0 ? 0x80 : 0x0);
- }
- }
- public bool AdditionalSpaceAbove
- {
- set { m_SpaceAbove = (ushort)(value ? 0x1000 : 0x0);}
- }
- public bool AdditionalSpaceBelow
- {
- set {
- if (value)
- m_SpaceBelow = 0x2000;
- else
- m_SpaceBelow = 0;
- }
- }
- #region IRecords ³ÉÔ±
- public byte[] GetByte()
- {
- row.optionflags1 = (byte)(m_RowHidden | m_RowFontNoMatch | m_RowExplicitFormat);
- row.optionflags2 = 0x1;
- row.optionflags3 = (ushort)(m_XFIndex | m_SpaceAbove | m_SpaceBelow);
- return Globals.GetStructToBytes(row);
- }
- #endregion
- }
- }
|