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 RecordColInfo { public ushort opcode; public ushort length; public ushort firstcol; public ushort lastcol; public ushort width; public ushort xf; public ushort flags; public ushort notused; // Width is defined as 1/256 of the width of the zero character from the default font // as our default font is always Arial 10 then this value represents 1 pixel } public class ColInfo : IRecords { const Single multiplier = 36.57F; RecordColInfo colinfo; public ColInfo() { colinfo.opcode = 0x7D; colinfo.length = 0xC; colinfo.notused = 0x0 ; } public ushort FirstColumn { set {colinfo.firstcol = value;} } public ushort LastColumn { set {colinfo.lastcol = value;} } public ushort Width { set { colinfo.width = (ushort)(Math.Round(value * multiplier)); } } public ushort CellStyle { set { colinfo.xf = value;} } public bool Hidden { set { colinfo.flags = (ushort)(value ? 0x1 : 0x0); } } #region IRecords ³ΙΤ± public byte[] GetByte() { return Globals.GetStructToBytes(colinfo); } #endregion } }