public TableRowPropertiesMapping(XmlWriter writer, CharacterPropertyExceptions rowEndChpx)
     : base(writer)
 {
     _trPr    = _nodeFactory.CreateElement("w", "trPr", OpenXmlNamespaces.WordprocessingML);
     _tblPrEx = _nodeFactory.CreateElement("w", "tblPrEx", OpenXmlNamespaces.WordprocessingML);
     //_tblBorders = _nodeFactory.CreateElement("w", "tblBorders", OpenXmlNamespaces.WordprocessingML);
     _rowEndChpx = rowEndChpx;
 }
 public ParagraphPropertiesMapping(
     XmlWriter writer,
     ConversionContext ctx,
     WordDocument parentDoc,
     CharacterPropertyExceptions paraEndChpx)
     : base(writer)
 {
     this._parentDoc   = parentDoc;
     this._pPr         = this._nodeFactory.CreateElement("w", "pPr", OpenXmlNamespaces.WordprocessingML);
     this._framePr     = this._nodeFactory.CreateElement("w", "framePr", OpenXmlNamespaces.WordprocessingML);
     this._paraEndChpx = paraEndChpx;
     this._ctx         = ctx;
 }
Ejemplo n.º 3
0
        private string getOleEntryName(CharacterPropertyExceptions chpx)
        {
            string ret = null;

            foreach (SinglePropertyModifier sprm in chpx.grpprl)
            {
                if (sprm.OpCode == SinglePropertyModifier.OperationCode.sprmCPicLocation)
                {
                    ret = "_" + System.BitConverter.ToUInt32(sprm.Arguments, 0);
                    break;
                }
            }

            return(ret);
        }
Ejemplo n.º 4
0
 public ParagraphPropertiesMapping(
     XmlWriter writer,
     ConversionContext ctx,
     WordDocument parentDoc,
     CharacterPropertyExceptions paraEndChpx,
     SectionPropertyExceptions sepx,
     int sectionNr)
     : base(writer)
 {
     _parentDoc   = parentDoc;
     _pPr         = _nodeFactory.CreateElement("w", "pPr", OpenXmlNamespaces.WordprocessingML);
     _framePr     = _nodeFactory.CreateElement("w", "framePr", OpenXmlNamespaces.WordprocessingML);
     _paraEndChpx = paraEndChpx;
     _sepx        = sepx;
     _ctx         = ctx;
     _sectionNr   = sectionNr;
 }
Ejemplo n.º 5
0
        public OleObject(CharacterPropertyExceptions chpx, StructuredStorageReader docStorage)
        {
            this._docStorage = docStorage;
            this.ObjectId    = getOleEntryName(chpx);

            this.Path = "\\ObjectPool\\" + this.ObjectId + "\\";
            processOleStream(this.Path + "\u0001Ole");

            if (this.fLinked)
            {
                processLinkInfoStream(this.Path + "\u0003LinkInfo");
            }
            else
            {
                processCompObjStream(this.Path + "\u0001CompObj");
            }

            //get the storage entries of this object
            this.Streams = new Dictionary <string, VirtualStream>();
            foreach (string streamname in docStorage.FullNameOfAllStreamEntries)
            {
                if (streamname.StartsWith(this.Path))
                {
                    this.Streams.Add(streamname.Substring(streamname.LastIndexOf("\\") + 1), docStorage.GetStream(streamname));
                }
            }

            //find the class if of this object
            foreach (DirectoryEntry entry in docStorage.AllEntries)
            {
                if (entry.Name == this.ObjectId)
                {
                    this.ClassId = entry.ClsId;
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Method for testing FKP CHPX
        /// </summary>
        private static void testFKPCHPX()
        {
            List <FormattedDiskPageCHPX> chpxFkps = FormattedDiskPageCHPX.GetAllCHPXFKPs(doc.FIB, doc.WordDocumentStream, doc.TableStream);

            Console.WriteLine("There are " + chpxFkps.Count + " FKPs with CHPX in this file: \n");
            foreach (FormattedDiskPageCHPX fkp in chpxFkps)
            {
                Console.Write("FKP matches on " + fkp.crun + " characters: ");
                foreach (int mark in fkp.rgfc)
                {
                    Console.Write(mark + " ");
                }
                Console.WriteLine("");
                for (int i = 0; i < fkp.crun; i++)
                {
                    Console.WriteLine("CHPX:");
                    CharacterPropertyExceptions chpx = fkp.grpchpx[i];
                    //foreach (SinglePropertyModifier sprm in chpx.grpprl)
                    //{
                    //    Console.WriteLine(String.Format("\tSPRM: modifies " + sprm.Type + " property 0x{0:x4} (" + sprm.Arguments.Length + " bytes)", sprm.OpCode));
                    //}
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Collects the revision data of a CHPX
        /// </summary>
        /// <param name="chpx"></param>
        public RevisionData(CharacterPropertyExceptions chpx)
        {
            bool collectRevisionData = true;

            this.Changes = new List <SinglePropertyModifier>();

            foreach (SinglePropertyModifier sprm in chpx.grpprl)
            {
                switch ((int)sprm.OpCode)
                {
                //revision data
                case 0xCA89:
                    //revision mark
                    collectRevisionData = false;
                    //author
                    this.Isbt = System.BitConverter.ToInt16(sprm.Arguments, 1);
                    //date
                    byte[] dttmBytes = new byte[4];
                    Array.Copy(sprm.Arguments, 3, dttmBytes, 0, 4);
                    this.Dttm = new DateAndTime(dttmBytes);
                    break;

                case 0x0801:
                    //revision mark
                    collectRevisionData = false;
                    break;

                case 0x4804:
                    //author
                    this.Isbt = System.BitConverter.ToInt16(sprm.Arguments, 0);
                    break;

                case 0x6805:
                    //date
                    this.Dttm = new DateAndTime(sprm.Arguments);
                    break;

                case 0x0800:
                    //delete mark
                    this.Type = RevisionType.Deleted;
                    break;

                case 0x6815:
                    this.RsidProp = System.BitConverter.ToInt32(sprm.Arguments, 0);
                    break;

                case 0x6816:
                    this.Rsid = System.BitConverter.ToInt32(sprm.Arguments, 0);
                    break;

                case 0x6817:
                    this.RsidDel = System.BitConverter.ToInt32(sprm.Arguments, 0);
                    break;
                }

                //put the sprm on the revision stack
                if (collectRevisionData)
                {
                    this.Changes.Add(sprm);
                }
            }

            //type
            if (this.Type != RevisionType.Deleted)
            {
                if (collectRevisionData)
                {
                    //no mark was found, so this CHPX doesn't contain revision data
                    this.Type = RevisionType.NoRevision;
                }
                else
                {
                    if (this.Changes.Count > 0)
                    {
                        this.Type = RevisionType.Changed;
                    }
                    else
                    {
                        this.Type = RevisionType.Inserted;
                        this.Changes.Clear();
                    }
                }
            }
        }
Ejemplo n.º 8
0
 private static void buildFirstCHP()
 {
     CharacterPropertyExceptions chpx = doc.AllChpxFkps[0].grpchpx[0];
     ParagraphPropertyExceptions papx = doc.AllPapxFkps[0].grppapx[0];
     CharacterProperties         chp  = new CharacterProperties(chpx, papx, doc);
 }