Ejemplo n.º 1
0
        private PlexOfCps ReadPLCF(byte[] tableStream, FileInformationBlock fib,
                FieldsDocumentPart documentPart)
        {
            int start = fib.GetFieldsPlcfOffset(documentPart);
            int length = fib.GetFieldsPlcfLength(documentPart);

            if (start <= 0 || length <= 0)
                return null;

            return new PlexOfCps(tableStream, start, length, FLD_SIZE);
        }
Ejemplo n.º 2
0
        public Field GetFieldByStartOffset(FieldsDocumentPart documentPart,
                                           int offset)
        {
            Dictionary <int, FieldImpl> map = _fieldsByOffset[documentPart];

            if (map == null || map.Count == 0)
            {
                return(null);
            }

            return(map[offset]);
        }
Ejemplo n.º 3
0
        private PlexOfCps ReadPLCF(byte[] tableStream, FileInformationBlock fib,
                                   FieldsDocumentPart documentPart)
        {
            int start  = fib.GetFieldsPlcfOffset(documentPart);
            int length = fib.GetFieldsPlcfLength(documentPart);

            if (start <= 0 || length <= 0)
            {
                return(null);
            }

            return(new PlexOfCps(tableStream, start, length, FLD_SIZE));
        }
Ejemplo n.º 4
0
        public List <Field> GetFields(FieldsDocumentPart part)
        {
            Dictionary <int, FieldImpl> map = _fieldsByOffset[part];

            if (map == null || map.Count == 0)
            {
                return(new List <Field>());
            }

            List <Field> vList = new List <Field>();

            foreach (Field f in map.Values)
            {
                vList.Add(f);
            }
            return(vList);
        }
Ejemplo n.º 5
0
        public void TestReadFields()
        {
            FileInformationBlock fib = _hWPFDocFixture._fib;

            byte[] tableStream = _hWPFDocFixture._tableStream;

            FieldsTables fieldsTables = new FieldsTables(tableStream, fib);

            Array values = Enum.GetValues(typeof(FieldsDocumentPart));

            for (int i = 0; i < values.Length; i++)
            {
                FieldsDocumentPart part = (FieldsDocumentPart)values.GetValue(i);

                List <PlexOfField> fieldsPlexes = fieldsTables
                                                  .GetFieldsPLCF(part);
                String result = DumpPlexes(fieldsPlexes);
                Assert.AreEqual(EXPECTED[i], result);
            }
        }
Ejemplo n.º 6
0
        private int SavePlex(FileInformationBlock fib, FieldsDocumentPart part,
                PlexOfCps plexOfCps, HWPFStream outputStream)
        {
            if (plexOfCps == null || plexOfCps.Length == 0)
            {
                fib.SetFieldsPlcfOffset(part, outputStream.Offset);
                fib.SetFieldsPlcfLength(part, 0);
                return 0;
            }

            byte[] data = plexOfCps.ToByteArray();

            int start = outputStream.Offset;
            int length = data.Length;

            outputStream.Write(data);

            fib.SetFieldsPlcfOffset(part, start);
            fib.SetFieldsPlcfLength(part, length);

            return length;
        }
Ejemplo n.º 7
0
        private int SavePlex(FileInformationBlock fib, FieldsDocumentPart part,
                             PlexOfCps plexOfCps, HWPFStream outputStream)
        {
            if (plexOfCps == null || plexOfCps.Length == 0)
            {
                fib.SetFieldsPlcfOffset(part, outputStream.Offset);
                fib.SetFieldsPlcfLength(part, 0);
                return(0);
            }

            byte[] data = plexOfCps.ToByteArray();

            int start  = outputStream.Offset;
            int length = data.Length;

            outputStream.Write(data);

            fib.SetFieldsPlcfOffset(part, start);
            fib.SetFieldsPlcfLength(part, length);

            return(length);
        }
Ejemplo n.º 8
0
 public void SetFieldsPlcfLength(FieldsDocumentPart part, int length)
 {
     _fieldHandler.SetFieldSize((int)part, length);
 }
Ejemplo n.º 9
0
 public void SetFieldsPlcfOffset(FieldsDocumentPart part, int offSet)
 {
     _fieldHandler.SetFieldOffset((int)part, offSet);
 }
Ejemplo n.º 10
0
 public int GetFieldsPlcfLength(FieldsDocumentPart part)
 {
     return _fieldHandler.GetFieldSize((int)part);
 }
Ejemplo n.º 11
0
 public int GetFieldsPlcfOffset(FieldsDocumentPart part)
 {
     return _fieldHandler.GetFieldOffset((int)part);
 }
Ejemplo n.º 12
0
 public int GetFieldsPlcfLength(FieldsDocumentPart part)
 {
     return(_fieldHandler.GetFieldSize((int)part));
 }
Ejemplo n.º 13
0
 public List <PlexOfField> GetFieldsPLCF(FieldsDocumentPart part)
 {
     return(ToArrayList(_tables[part]));
 }
Ejemplo n.º 14
0
 public void SetFieldsPlcfLength(FieldsDocumentPart part, int length)
 {
     _fieldHandler.SetFieldSize((int)part, length);
 }
Ejemplo n.º 15
0
 public void SetFieldsPlcfOffset(FieldsDocumentPart part, int offSet)
 {
     _fieldHandler.SetFieldOffset((int)part, offSet);
 }
Ejemplo n.º 16
0
 public List<PlexOfField> GetFieldsPLCF(FieldsDocumentPart part)
 {
     return ToArrayList(_tables[part]);
 }
Ejemplo n.º 17
0
 public int GetFieldsPlcfOffset(FieldsDocumentPart part)
 {
     return(_fieldHandler.GetFieldOffset((int)part));
 }