How to do so to get from them an array in which the separator can be both "-" and the paragraph?

Hello,


I have cells in the table that contain strings. How to do so to get from them an array in which the separator can be both “,” and the paragraph to send substrings to the constructor? For example on my picture I want get two arrays: {“String1”, “String2”} and {“String3”, “String4”}.
An example of my code that did not solve the problem:
String[] op = new Column(table, b+3).getCells()[u].getText().replace(ControlChar.LINE_BREAK, “,”).split(",");
Thank you.

Hi there,


Thanks for your inquiry. Please replace ControlChar.LINE_BREAK with ControlChar.PARAGRAPH_BREAK as shown below to get the desired output. Hope this helps you.

<pre style=“font-family: “Courier New”; font-size: 9pt;”>Document doc = new Document(MyDir + “in.docx”);

Table table = (Table)doc.getChild(NodeType.TABLE, 0, true);
Cell cell = table.getFirstRow().getFirstCell();

String[] text = cell.getText().replace(
ControlChar.PARAGRAPH_BREAK, “,”).split(",");
for (int i = 0; i < text.length; i++)
{
System.
out.println(text[i]);
}
<pre style=“font-family: “Courier New”; font-size: 9pt;”>