Hello,
I am structuring a document using a conversion table. I want to be able to apply a specific paragraph format to those paragraph format names that do not appear in the conversion table. I am having difficulty getting text from the cellIds in the Conversion table. All I get are the format names in the paragraph catalog. Maybe I am missing something here...I would appreciate any inputs.
Am pasting some code, where I've gotten so far...Questions pertaining to this issue are in the comments inline.
//Get docId, flowId, textFrameId and pgfId here...
//Open Conversion Table document here...ID is "convTabId"
F_TextRangeT ctr;
F_PropValsT props;
while(pgfId) {
//Traverse through paragraphs in the current document (docId) and get their format names.
pgfName = F_ApiGetString(docId, pgfId, FP_Name);
if(!pgfName) return;
//Check if this pgfName is in the conversion table's first column..RICI, R2C1,R3C1...
retVal = IsInConvTable(convTabId,pgfName);
//retVal contains 1 if pgfName is in Conversion table, 0 otherwise..
if(!retVal) {
//Apply "Body" format to this paragraph.
bodyFmtId = F_ApiGetNamedObject(docId,FO_PgfFmt,"Body");
if(!bodyFmtId) return;
props = F_ApiGetProps(docId,bodyFmtId);
if(props.len == 0) return;
ctr.beg.objId = ctr.end.objId = pgfId;
ctr.beg.offset = 0;
ctr.end.offset = FV_OBJ_END_OFFSET;
F_ApiSetTextRange(FV_SessionId, docId, FP_TextSelection, &ctr);
F_ApiSetProps(docId,ctr.beg.objId,&props);
}
pgfId = F_ApiGetId(docId,pgfId,FP_NextPgfInFlow);
}
int IsInConvTable(F_ObjHandleT convTabId, ConStringT paraName)
{
//declare tblId, rowId, cellId, paraId;
F_TextItemsT textItems;
IntT retVal=0, i;
F_TextRangeT tr;
//Get Table and Row Ids
tblId = F_ApiGetId(FV_SessionId, convTabId, FP_FirstTblInDoc);
rowId = F_ApiGetId(convTabId, tblId, FP_FirstRowInTbl);
while(rowId) {
//Get Cell Ids of only the first column in each row of the Conversion table.
cellId = F_ApiGetId(convTabId, rowId,FP_FirstCellInRow);
paraId = F_ApiGetId(convTabId, cellId, FP_FirstPgf);
tr.beg.objId = tr.end.objId = paraId;
tr.beg.offset = 0;
tr.end.offset = FV_OBJ_END_OFFSET;
F_ApiSetTextRange(FV_SessionId, convTabId,FP_TextSelection,&tr);
textItems = F_ApiGetTextForRange(convTabId,&tr,FTI_String);
//Here textItems contains names in Paragraph Catalog, such as, P:Body, P:Heading1...
//I require the entries in the conversion table and not those in the Paragraph catalog...
//This happens if the following command is used too:
//textItems = F_ApiGetText(convtabId,cellId,FTI_String);
if (textItems.len != 0)
//How do we cast textItems values to ConStringT, for the following substring operation?
i = F_StrSubString(textItems,paraName);
if ( != -1)
retVal=1;
F_ApiDeallocateTextItems(&textItems);
rowId = F_ApiGetId(convTabId, rowId, FP_NextRowInTbl);
}
return retVal;
}
Many thanks,
pnk