Exemplo n.º 1
0
        /// <summary>
        /// Builds a CHP based on a CHPX
        /// </summary>
        /// <param name="styles">The stylesheet</param>
        /// <param name="chpx">The CHPX</param>
        public CharacterProperties(CharacterPropertyExceptions chpx, ParagraphPropertyExceptions parentPapx, WordDocument parentDocument)
        {
            setDefaultValues();

            //get all CHPX in the hierarchy
            var chpxHierarchy = new List <CharacterPropertyExceptions>();

            chpxHierarchy.Add(chpx);

            //add parent character styles
            buildHierarchy(chpxHierarchy, parentDocument.Styles, (ushort)getIsdt(chpx));

            //add parent paragraph styles
            buildHierarchy(chpxHierarchy, parentDocument.Styles, parentPapx.istd);

            chpxHierarchy.Reverse();

            //apply the CHPX hierarchy to this CHP
            foreach (var c in chpxHierarchy)
            {
                applyChpx(c, parentDocument);
            }
        }