1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- 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)]
- internal struct StructMergedCells
- {
- public ushort mcFirstRow;
- public ushort mcLastRow;
- public ushort mcFirstCol;
- public ushort mcLastCol;
- }
- [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
- struct RecordMergedCells
- {
- public ushort opcode;
- public ushort length;
- public ushort total;
- }
- internal class MergedCells : IRecords
- {
- RecordMergedCells mergedcells;
- StructMergedCells[] structmergedcells;
- public MergedCells()
- {
- mergedcells.opcode = 0xE5;
- }
- public StructMergedCells[] SetMergedCells
- {
- set
- {
- try
- {
- mergedcells.total = (ushort)value.Length;
- structmergedcells = value;
- }
- catch
- {
- throw;
- }
- }
- }
- #region IRecords ³ÉÔ±
- public byte[] GetByte()
- {
- int len = 6 + (8 * mergedcells.total);
- byte[] b = new byte[len];
- mergedcells.length = (ushort)(len - 4);
- Globals.GetStructToBytes(mergedcells).CopyTo(b, 0);
- int pos = 6;
- for (int i = 0; i < mergedcells.total; i++, pos += 8)
- {
- Globals.GetStructToBytes(structmergedcells[i]).CopyTo(b, pos);
- }
- return b;
- }
- #endregion
- }
- }
|