Check if a single Text Item in a cell is bold and then grab the string that is bold
I have written a script that runs through a table and parses out the information I need to create another table with some added information.
The last piece that I can't seem to figure out is how to check if some text in a cell is bold and then grab said text to put in the new table.
I will give a small table demo of what I am try to retrieve.
Table A.
| Column 1 | Description |
|---|---|
| 123456 | This is a description (This is a note) |
| 789123 | This is a description (This is note A) (This is note B) (This is more stuff that isn't needed. |
Table B.
| Column 1 | Column 2 | Note |
|---|---|---|
| 1 | 123456 | (This is a note) |
| 2 | 789123 | (This is note A) (This is note B) |
I can pull all of the other information across that I am trying to get without any issue.
I can't seem to figure out how to check the formatting of a TextItem to see if it is bold. I have been able to figure out how to check if a cell has bold text in it. using if ((tItems[counterVar].idata & Constants.FTF_WEIGHT) > 0). This ends up not working well because of a few issues. I was wondering if there is any way to check the formatting of a single character?
I tried something similar to the following:
prop_Change = tbl_Description_Cell.GetText(Constants.FTI_CharPropsChange);
txt_String = tbl_Description_Cell.GetText(Constants.FTI_String);
if (prop_Change.len > 0)
{
if((prop_Change[0].idata & Constants.FTF_WEIGHT) > 0)
{
pOffset = prop_Change[0].offset;
for (var tbl_tItems = 0; tbl_tItems < txt_String.len; tbl_tItems++)
{
tOffset = txt_String[tbl_tItems].offset
if(tOffset == pOffset)
{
alert(txt_String[tbl_tItems].sdata);
}
}
}
}
Thanks,
Steven
