Пример #1
0
 internal Paragraph(PAPX papx, Range parent)
     : base(Math.Max(parent._start, papx.Start), Math.Min(parent._end, papx.End), parent)
 {
     _props = papx.GetParagraphProperties(_doc.GetStyleSheet());
     _papx  = papx.GetSprmBuf();
     _istd  = papx.GetIstd();
 }
Пример #2
0
        internal Paragraph(int startIdx, int endIdx, Table parent)
            : base(startIdx, endIdx, parent)
        {
            InitAll();
            PAPX papx = (PAPX)_paragraphs[_parEnd - 1];

            _props = papx.GetParagraphProperties(_doc.GetStyleSheet());
            _papx  = papx.GetSprmBuf();
            _istd  = papx.GetIstd();
        }
Пример #3
0
        public CharacterRun InsertAfter(String text, CharacterProperties props)
        //
        {
            InitAll();
            PAPX  papx = _paragraphs[_parEnd - 1];
            short istd = papx.GetIstd();

            StyleSheet          ss        = _doc.GetStyleSheet();
            CharacterProperties baseStyle = ss.GetCharacterStyle(istd);

            byte[]     grpprl = CharacterSprmCompressor.CompressCharacterProperty(props, baseStyle);
            SprmBuffer buf    = new SprmBuffer(grpprl);

            _doc.CharacterTable.Insert(_charEnd, _end, buf);
            _charEnd++;
            return(InsertAfter(text));
        }
Пример #4
0
        /**
         * Gets the character run at index. The index is relative to this range.
         *
         * @param index
         *            The index of the character run to Get.
         * @return The character run at the specified index in this range.
         */
        public CharacterRun GetCharacterRun(int index)
        {
            InitCharacterRuns();

            if (index + _charStart >= _charEnd)
            {
                throw new IndexOutOfRangeException("CHPX #" + index + " ("
                                                   + (index + _charStart) + ") not in range [" + _charStart
                                                   + "; " + _charEnd + ")");
            }

            CHPX chpx = _characters[index + _charStart];

            if (chpx == null)
            {
                return(null);
            }
            short istd;

            if (this is Paragraph)
            {
                istd = ((Paragraph)this)._istd;
            }
            else
            {
                int[] point = FindRange(_paragraphs, Math.Max(chpx.Start, _start), Math.Min(chpx.End, _end));
                InitParagraphs();
                int parStart = Math.Max(point[0], _parStart);
                if (parStart >= _paragraphs.Count)
                {
                    return(null);
                }
                PAPX papx = _paragraphs[point[0]];
                istd = papx.GetIstd();
            }

            CharacterRun chp = new CharacterRun(chpx, _doc.GetStyleSheet(), istd, this);

            return(chp);
        }