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.

asked 20 Sep '16, 07:17

Shaown's gravatar image

Shaown
175

edited 20 Sep '16, 07:19


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; }

link

answered 21 Sep '16, 13:43

Robert%20Klaij's gravatar image

Robert Klaij
312

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

link

answered 24 Sep '16, 17:48

Shaown's gravatar image

Shaown
175

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×47
×11
×10
×6
×4

Asked: 20 Sep '16, 07:17

Seen: 853 times

Last updated: 24 Sep '16, 17:48

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal