Hello,
I am working with DocIO in my Xamarin.Forms app and need to read a table cells text but am not able to get the text with carriage returns (aka new lines). For example if my cell text is:
Corpus Christi
Texas
78414
I get (note that I am manually adding "\r\n" to display my text with returns as it seems all carriage returns and new line characters are consumed by the WTextRange):
Corpus Christi
Texas
78414
Using the following code:
row = section.Tables[tableVal].Rows[rowVal];
cell = row.Cells[cellVal];
foreach (WParagraph para in cell.Paragraphs)
{
foreach (ParagraphItem paraItem in para.ChildEntities)
{
if (paraItem is WTextRange)
{
WTextRange textItem = paraItem as WTextRange;
if (text == "")
{
if (textItem.Text == "")
{
text = "\r\n";
}
else
{
text = textItem.Text;
}
}
else
{
if (textItem.Text == "")
{
text += "\r\n";
}
else
{
text += "\r\n";
text += textItem.Text;
}
}
}
}
}
Question 1: How do I get all of the cells contents including new lines
Question 2: Is there a method that I can use to simply get all text in a cell with all of the loops? Something like string text = cell.Paragraph.Text?
Thanks for any help you can provide.