コミュニティ

How to get cell value from ITableBlock object

I have object of tableblock type ie: fields.getElement(0).getBlocks().Item(0).AsTableBlock(). Now my concern is how can I get the cell data as IField/IFieldValue type. I try to extract the cell data. So is it possible to get cell value as IField type or how can I get the cell data as text. My tableBlock data are all text type.

この記事は役に立ちましたか?

0人中0人がこの記事が役に立ったと言っています

コメント

2件のコメント

  • Avatar
    Permanently deleted user

    I used a loop to cycle through all the cells of the TableBlock and for each cell get the data out of it. Hope this gives you an idea how to solve it.

    private static string ProcessTable(IBlock Block) { string OutputString = ""; ITableBlock TableBlock = Block.GetAsTableBlock(); if (TableBlock != null) { for (int CellCount = 0; CellCount < TableBlock.Cells.Count; CellCount++) { ITableCell CellData = TableBlock.Cells[CellCount]; if (CellData != null) { IBlock CellBlock = CellData.Block; if (CellBlock.Type == BlockTypeEnum.BT_Text) { OutputString += ProcessText(CellBlock); } else if (CellBlock.Type == BlockTypeEnum.BT_Table) { OutputString += ProcessTable(CellBlock); } } } } else { // write in Errorlog read failed } return OutputString; } private static string ProcessText(IBlock Block) { string OutputString = ""; TextBlock textblock = Block.GetAsTextBlock(); if (textblock != null) { for (int ParagraphCount = 0; ParagraphCount < textblock.Text.Paragraphs.Count; ParagraphCount++ ) { int t = textblock.Text.Paragraphs[ParagraphCount].Words.Count; Paragraph Paragraph = textblock.Text.Paragraphs[ParagraphCount]; for (int WordCount = 0; WordCount < Paragraph.Words.Count; WordCount++ ) { Word Word = Paragraph.Words[WordCount]; OutputString += Word.Text + " "; } } } else { // write in Errorlog read failed } return OutputString; }

    2
  • Avatar
    Permanently deleted user

    thanks Robert for the reply....I placed the idea in my queue.

    0

サインインしてコメントを残してください。