コード例 #1
0
ファイル: TextRun.cs プロジェクト: hanwangkun/npoi
	/**
	 * Internal constructor and Initializer
	 */
	private TextRun(TextHeaderAtom tha, TextBytesAtom tba, TextCharsAtom tca, StyleTextPropAtom sta) {
		_headerAtom = tha;
		_styleAtom = sta;
		if(tba != null) {
			_byteAtom = tba;
			_isUnicode = false;
		} else {
			_charAtom = tca;
			_isUnicode = true;
		}
		String RunRawText = GetText();

		// Figure out the rich text Runs
		LinkedList pStyles = new LinkedList();
		LinkedList cStyles = new LinkedList();
		if(_styleAtom != null) {
			// Get the style atom to grok itself
			_styleAtom.SetParentTextSize(RunRawText.Length);
			pStyles = _styleAtom.GetParagraphStyles();
			cStyles = _styleAtom.GetCharacterStyles();
		}
        buildRichTextRuns(pStyles, cStyles, RunRawText);
	}
コード例 #2
0
ファイル: TextShape.cs プロジェクト: ctddjyds/npoi
    public TextRun CreateTextRun(){
        _txtbox = GetEscherTextboxWrapper();
        if(_txtbox == null) _txtbox = new EscherTextboxWrapper();

        _txtrun = GetTextRun();
        if(_txtrun == null){
            TextHeaderAtom tha = new TextHeaderAtom();
            tha.SetParentRecord(_txtbox);
            _txtbox.AppendChildRecord(tha);

            TextCharsAtom tca = new TextCharsAtom();
            _txtbox.AppendChildRecord(tca);

            StyleTextPropAtom sta = new StyleTextPropAtom(0);
            _txtbox.AppendChildRecord(sta);

            _txtrun = new TextRun(tha,tca,sta);
            _txtRun._records = new Record[]{tha, tca, sta};
            _txtRun.SetText("");

            _escherContainer.AddChildRecord(_txtbox.GetEscherRecord());

            SetDefaultTextProperties(_txtRun);
        }

        return _txtRun;
    }
コード例 #3
0
        public string readFooterFromClientTextBox(ClientTextbox textbox)
        {
            var            ms     = new System.IO.MemoryStream(textbox.Bytes);
            TextHeaderAtom thAtom = null;
            TextStyleAtom  style  = null;
            var            lst    = new List <int>();

            while (ms.Position < ms.Length)
            {
                var rec = Record.ReadRecord(ms);

                switch (rec.TypeCode)
                {
                case 0xf9e:     //OutlineTextRefAtom
                    var otrAtom           = (OutlineTextRefAtom)rec;
                    var slideListWithText = this._ctx.Ppt.DocumentRecord.RegularSlideListWithText;

                    var thAtoms = slideListWithText.SlideToPlaceholderTextHeaders[textbox.FirstAncestorWithType <Slide>().PersistAtom];
                    thAtom = thAtoms[otrAtom.Index];

                    //if (thAtom.TextAtom != null) text = thAtom.TextAtom.Text;
                    if (thAtom.TextStyleAtom != null)
                    {
                        style = thAtom.TextStyleAtom;
                    }
                    break;

                case 0xf9f:     //TextHeaderAtom
                    thAtom = (TextHeaderAtom)rec;
                    break;

                case 0xfa0:     //TextCharsAtom
                    thAtom.TextAtom = (TextAtom)rec;
                    break;

                case 0xfa1:     //StyleTextPropAtom
                    style = (TextStyleAtom)rec;
                    style.TextHeaderAtom = thAtom;
                    break;

                case 0xfa2:     //MasterTextPropAtom
                    break;

                case 0xfa8:     //TextBytesAtom
                    //text = ((TextBytesAtom)rec).Text;
                    thAtom.TextAtom = (TextAtom)rec;
                    return(thAtom.TextAtom.Text);

                case 0xfaa:     //TextSpecialInfoAtom
                case 0xfd8:     //SlideNumberMCAtom
                case 0xff9:     //HeaderMCAtom
                    break;

                case 0xffa:     //FooterMCAtom
                    break;

                case 0xff8:     //GenericDateMCAtom
                    break;

                default:
                    break;
                }
            }

            return("");
        }
コード例 #4
0
ファイル: TextRun.cs プロジェクト: hanwangkun/npoi
	/**
	* Constructs a Text Run from a Ascii text block
	*
	* @param tha the TextHeaderAtom that defines what's what
	* @param tba the TextBytesAtom Containing the text
	* @param sta the StyleTextPropAtom which defines the character stylings
	*/
	public TextRun(TextHeaderAtom tha, TextBytesAtom tba, StyleTextPropAtom sta) {
		this(tha,tba,null,sta);
	}
コード例 #5
0
ファイル: TextRun.cs プロジェクト: hanwangkun/npoi
	/**
	* Constructs a Text Run from a Unicode text block
	*
	* @param tha the TextHeaderAtom that defines what's what
	* @param tca the TextCharsAtom Containing the text
	* @param sta the StyleTextPropAtom which defines the character stylings
	*/
	public TextRun(TextHeaderAtom tha, TextCharsAtom tca, StyleTextPropAtom sta) {
		this(tha,null,tca,sta);
	}