public override int Serialize(int offset, byte[] data)
 {
     ILittleEndianOutput leo = new LittleEndianByteArrayOutputStream(data, offset);
     ContinuableRecordOutput out1 = new ContinuableRecordOutput(leo, this.Sid);
     Serialize(out1);
     out1.Terminate();
     return out1.TotalSize;
 }
Esempio n. 2
0
        public override int Serialize(int offset, byte[] data)
        {
            ILittleEndianOutput     leo  = new LittleEndianByteArrayOutputStream(data, offset);
            ContinuableRecordOutput out1 = new ContinuableRecordOutput(leo, this.Sid);

            Serialize(out1);
            out1.Terminate();
            return(out1.TotalSize);
        }
Esempio n. 3
0
        public void Serialize(ContinuableRecordOutput out1)
        {
            out1.WriteInt(_numStrings);
            out1.WriteInt(_numUniqueStrings);

            for (int k = 0; k < strings.Size; k++)
            {
                if (k % ExtSSTRecord.DEFAULT_BUCKET_SIZE == 0)
                {
                    int rOff = out1.TotalSize;
                    int index = k / ExtSSTRecord.DEFAULT_BUCKET_SIZE;
                    if (index < ExtSSTRecord.MAX_BUCKETS)
                    {
                        //Excel only indexes the first 128 buckets.
                        bucketAbsoluteOffsets[index] = rOff;
                        bucketRelativeOffsets[index] = rOff;
                    }
                }
                UnicodeString s = GetUnicodeString(k);
                s.Serialize(out1);
            }
        }
Esempio n. 4
0
 /**
  * called by the class that Is responsible for writing this sucker.
  * Subclasses should implement this so that their data Is passed back in a
  * byte array.
  *
  * @param offset to begin writing at
  * @param data byte array containing instance data
  * @return number of bytes written
  */
 protected override void Serialize(ContinuableRecordOutput out1)
 {
     out1.WriteShort(this._text.Length);
     out1.WriteStringData(this._text);
 }
Esempio n. 5
0
        /**
         * called by the class that Is responsible for writing this sucker.
         * Subclasses should implement this so that their data Is passed back in a
         * byte array.
         *
         * @return size
         */

    protected override void Serialize(ContinuableRecordOutput out1) {
        SSTSerializer serializer = new SSTSerializer(field_3_strings, NumStrings, NumUniqueStrings );
        serializer.Serialize(out1);
        bucketAbsoluteOffsets = serializer.BucketAbsoluteOffsets;
        bucketRelativeOffsets = serializer.BucketRelativeOffsets;
    }
 /**
  * Serializes this record's content to the supplied data output.<br/>
  * The standard BIFF header (ushort sid, ushort size) has been handled by the superclass, so 
  * only BIFF data should be written by this method.  Simple data types can be written with the
  * standard {@link LittleEndianOutput} methods.  Methods from {@link ContinuableRecordOutput} 
  * can be used to Serialize strings (with {@link ContinueRecord}s being written as required).
  * If necessary, implementors can explicitly start {@link ContinueRecord}s (regardless of the
  * amount of remaining space).
  * 
  * @param out a data output stream
  */
 protected abstract void Serialize(ContinuableRecordOutput out1);
        protected override void Serialize(ContinuableRecordOutput out1)
        {
            SerializeTXORecord(out1);

            if (_text.String.Length > 0)
            {
                SerializeTrailingRecords(out1);
            }
        }
        private void SerializeTXORecord(ContinuableRecordOutput out1)
        {
            out1.WriteShort(field_1_options);
            out1.WriteShort(field_2_textOrientation);
            out1.WriteShort(field_3_reserved4);
            out1.WriteShort(field_4_reserved5);
            out1.WriteShort(field_5_reserved6);
            out1.WriteShort(_text.Length);
            out1.WriteShort(FormattingDataLength);
            out1.WriteInt(field_8_reserved7);

            if (_linkRefPtg != null)
            {
                int formulaSize = _linkRefPtg.Size;
                out1.WriteShort(formulaSize);
                out1.WriteInt(_unknownPreFormulaInt);
                _linkRefPtg.Write(out1);

                if (_unknownPostFormulaByte != null)
                {
                    out1.WriteByte(Convert.ToByte(_unknownPostFormulaByte, CultureInfo.InvariantCulture));
                }
            }
        }
 private void WriteFormatData(ContinuableRecordOutput out1, IRichTextString str)
 {
     int nRuns = str.NumFormattingRuns;
     for (int i = 0; i < nRuns; i++)
     {
         out1.WriteShort(str.GetIndexOfFormattingRun(i));
         int fontIndex = ((HSSFRichTextString)str).GetFontOfFormattingRun(i);
         out1.WriteShort(fontIndex == HSSFRichTextString.NO_FONT ? 0 : fontIndex);
         out1.WriteInt(0); // skip reserved
     }
     out1.WriteShort(str.Length);
     out1.WriteShort(0);
     out1.WriteInt(0); // skip reserved
 }
Esempio n. 10
0
 private void SerializeTrailingRecords(ContinuableRecordOutput out1)
 {
     out1.WriteContinue();
     out1.WriteStringData(_text.String);
     out1.WriteContinue();
     WriteFormatData(out1,_text);
 }
Esempio n. 11
0
 /**
  * Serializes this record's content to the supplied data output.<br/>
  * The standard BIFF header (ushort sid, ushort size) has been handled by the superclass, so
  * only BIFF data should be written by this method.  Simple data types can be written with the
  * standard {@link LittleEndianOutput} methods.  Methods from {@link ContinuableRecordOutput}
  * can be used to Serialize strings (with {@link ContinueRecord}s being written as required).
  * If necessary, implementors can explicitly start {@link ContinueRecord}s (regardless of the
  * amount of remaining space).
  *
  * @param out a data output stream
  */
 protected abstract void Serialize(ContinuableRecordOutput out1);
Esempio n. 12
0
 protected override void Serialize(ContinuableRecordOutput out1)
 {
     out1.WriteShort(field_1_strings_per_bucket);
     for (int k = 0; k < _sstInfos.Length; k++)
     {
         _sstInfos[k].Serialize(out1);
     }
 }
Esempio n. 13
0
        /**
         * called by the class that Is responsible for writing this sucker.
         * Subclasses should implement this so that their data Is passed back in a
         * @param offset to begin writing at
         * @param data byte array containing instance data
         * @return number of bytes written
         */
        protected override void Serialize(ContinuableRecordOutput out1)
        {
            int field_7_length_custom_menu = field_14_custom_menu_text.Length;
            int field_8_length_description_text = field_15_description_text.Length;
            int field_9_length_help_topic_text = field_16_help_topic_text.Length;
            int field_10_length_status_bar_text = field_17_status_bar_text.Length;
            //int rawNameSize = NameRawSize;

            // size defined below
            out1.WriteShort(OptionFlag);
            out1.WriteByte(KeyboardShortcut);
            out1.WriteByte(NameTextLength);
            // Note - formula size is not immediately before encoded formula, and does not include any array constant data
            out1.WriteShort(field_13_name_definition.EncodedTokenSize);
            out1.WriteShort(field_5_externSheetIndex_plus1);
            out1.WriteShort(field_6_sheetNumber);
            out1.WriteByte(field_7_length_custom_menu);
            out1.WriteByte(field_8_length_description_text);
            out1.WriteByte(field_9_length_help_topic_text);
            out1.WriteByte(field_10_length_status_bar_text);
            out1.WriteByte(field_11_nameIsMultibyte ? 1 : 0);

            if (IsBuiltInName)
            {
                out1.WriteByte(field_12_built_in_code);
            }
            else
            {
                String nameText = field_12_name_text;
                if (field_11_nameIsMultibyte)
                {
                    StringUtil.PutUnicodeLE(nameText,out1);
                }
                else
                {
                    StringUtil.PutCompressedUnicode(nameText, out1);
                }
            }
            field_13_name_definition.SerializeTokens(out1);
            field_13_name_definition.SerializeArrayConstantData(out1);

            StringUtil.PutCompressedUnicode(CustomMenuText,out1);
            StringUtil.PutCompressedUnicode(DescriptionText, out1);
            StringUtil.PutCompressedUnicode(HelpTopicText, out1);
            StringUtil.PutCompressedUnicode(StatusBarText, out1);
        }