Beispiel #1
0
        // Token: 0x0600029E RID: 670 RVA: 0x0000C7E4 File Offset: 0x0000B7E4
        private Bytes GetFormatRecord(ushort id, string format)
        {
            Bytes bytes = new Bytes();

            bytes.Append(BitConverter.GetBytes(id));
            bytes.Append(XlsDocument.GetUnicodeString(format, 16));
            return(Record.GetBytes(RID.FORMAT, bytes));
        }
Beispiel #2
0
        // Token: 0x06000147 RID: 327 RVA: 0x000073C0 File Offset: 0x000063C0
        private Bytes LABEL()
        {
            Bytes bytes = new Bytes();

            bytes.Append(this.LABELBase());
            bytes.Append(XlsDocument.GetUnicodeString(((string)this.Value) ?? string.Empty, 16));
            return(Record.GetBytes(RID.LABEL, bytes));
        }
Beispiel #3
0
        private Bytes LABEL()
        {
            Bytes label = new Bytes();

            label.Append(LABELBase());

            //Unicode string, 16-bit string length
            label.Append(XlsDocument.GetUnicodeString((string)Value ?? string.Empty, 16));

            return(Record.GetBytes(RID.LABEL, label));
        }
Beispiel #4
0
        private void AddStrings(List <string> stringList, ref int remainingRecordBytes, ref Bytes bytes, Bytes sst, ref bool isFirstContinue)
        {
            foreach (string sharedString in stringList)
            {
                Bytes stringBytes = XlsDocument.GetUnicodeString(sharedString, 16);

                //per excelfileformat.pdf sec. 5.22, can't split a
                //Unicode string to another CONTINUE record before
                //the first character's byte/s are written, and must
                //repeat string option flags byte if it is split
                //OPTIM: For smaller filesize, handle the possibility of compressing continued portion of uncompressed strings (low ROI!)
                byte stringOptionFlag = 0xFF;
                bool charsAre16Bit    = false;
                int  minimumToAdd     = int.MaxValue;

                if (stringBytes.Length > remainingRecordBytes)
                {
                    stringOptionFlag = stringBytes.Get(2, 1).ByteArray[0];
                    charsAre16Bit    = (stringOptionFlag & 0x01) == 0x01;
                    minimumToAdd     = charsAre16Bit ? 5 : 4;
                }

                while (stringBytes != null)
                {
                    if (stringBytes.Length > remainingRecordBytes) //add what we can and continue
                    {
                        bool stringWasSplit = false;
                        if (remainingRecordBytes > minimumToAdd)
                        {
                            int overLength = (stringBytes.Length - remainingRecordBytes);
                            bytes.Append(stringBytes.Get(0, remainingRecordBytes));
                            stringBytes           = stringBytes.Get(remainingRecordBytes, overLength);
                            remainingRecordBytes -= remainingRecordBytes;
                            stringWasSplit        = true;
                        }

                        bytes = Continue(sst, bytes, out remainingRecordBytes, ref isFirstContinue);

                        if (stringWasSplit)
                        {
                            bytes.Append(stringOptionFlag);
                            remainingRecordBytes--;
                        }
                    }
                    else //add what's left
                    {
                        bytes.Append(stringBytes);
                        remainingRecordBytes -= stringBytes.Length;
                        stringBytes           = null; //exit loop to continue to next sharedString
                    }
                }
            }
        }
Beispiel #5
0
        // Token: 0x060000CB RID: 203 RVA: 0x000063BC File Offset: 0x000053BC
        private static Bytes BOUNDSHEET(Worksheet sheet, int basePosition)
        {
            Bytes bytes         = new Bytes();
            Bytes unicodeString = XlsDocument.GetUnicodeString(sheet.Name, 8);

            bytes.Append(WorksheetVisibility.GetBytes(sheet.Visibility));
            bytes.Append(WorksheetType.GetBytes(sheet.SheetType));
            bytes.Append(unicodeString);
            bytes.Prepend(BitConverter.GetBytes(basePosition));
            bytes.Prepend(BitConverter.GetBytes((ushort)bytes.Length));
            bytes.Prepend(RID.BOUNDSHEET);
            return(bytes);
        }
Beispiel #6
0
        private static Bytes BOUNDSHEET(Worksheet sheet, int basePosition)
        {
            Bytes bytes = new Bytes();

            Bytes sheetName = XlsDocument.GetUnicodeString(sheet.Name, 8);

            bytes.Append(WorksheetVisibility.GetBytes(sheet.Visibility));
            bytes.Append(WorksheetType.GetBytes(sheet.SheetType));
            bytes.Append(sheetName);
            bytes.Prepend(BitConverter.GetBytes((int)basePosition));              //TODO: this should probably be unsigned 32 instead

            bytes.Prepend(BitConverter.GetBytes((ushort)bytes.Length));
            bytes.Prepend(RID.BOUNDSHEET);

            return(bytes);
        }
Beispiel #7
0
 // Token: 0x060000B6 RID: 182 RVA: 0x00005A9C File Offset: 0x00004A9C
 private void AddStrings(List <string> stringList, ref int remainingRecordBytes, ref Bytes bytes, Bytes sst, ref bool isFirstContinue)
 {
     foreach (string text in stringList)
     {
         Bytes bytes2 = XlsDocument.GetUnicodeString(text, 16);
         byte  b      = byte.MaxValue;
         int   num    = int.MaxValue;
         if (bytes2.Length > remainingRecordBytes)
         {
             b   = bytes2.Get(2, 1).ByteArray[0];
             num = (((b & 1) == 1) ? 5 : 4);
         }
         while (bytes2 != null)
         {
             if (bytes2.Length > remainingRecordBytes)
             {
                 bool flag = false;
                 if (remainingRecordBytes > num)
                 {
                     int getLength = bytes2.Length - remainingRecordBytes;
                     bytes.Append(bytes2.Get(0, remainingRecordBytes));
                     bytes2 = bytes2.Get(remainingRecordBytes, getLength);
                     remainingRecordBytes -= remainingRecordBytes;
                     flag = true;
                 }
                 bytes = this.Continue(sst, bytes, out remainingRecordBytes, ref isFirstContinue);
                 if (flag)
                 {
                     bytes.Append(b);
                     remainingRecordBytes--;
                 }
             }
             else
             {
                 bytes.Append(bytes2);
                 remainingRecordBytes -= bytes2.Length;
                 bytes2 = null;
             }
         }
     }
 }