How to apply <ICompositionStyle> to text box item
Hi,
I am trying to modify TabStop for text frame in Indesign document.
For that I am doing following:
//Get IGeometry for textframe
InterfacePtr<IGeometry> iGeometry(frameUIDRef, IID_IGEOMETRY);
//Get IMultiColumnTextFrame for textframe
InterfacePtr<IMultiColumnTextFrame> iMultiColumnTextFrame(parentUIDRef.GetDataBase(), Utils<IFrameUtils>()->GetTextFrameUID(iGeometry), IID_IMULTICOLUMNTEXTFRAME);
//Get ITextModel for IMultiColumnTextFrame
InterfacePtr<ITextModel> textModel(iMultiColumnTextFrame->QueryTextModel());
//Get IComposeScanner for ITextModel
InterfacePtr <IComposeScanner> composer(textModel, IID_ICOMPOSESCANNER);
//Get drawingStyle from IComposeScanner
IDrawingStyle* drawingStyle = composer->GetCompleteStyleAt(0,&len);
//Get ICompositionStyle from drawingStyle
InterfacePtr <ICompositionStyle> compositionStyle(drawingStyle, IID_ICOMPOSITIONSTYLE);
//Get TabStopTable from ICompositionStyle
TabStopTable iTabStopTable;
iTabStopTable = compositionStyle->GetTabRuler() ;
//Check TabStopTable values
PMReal tabVal = iTabStopTable.GetDefaultTabInterval();
for(int32 i=0; i<iTabStopTable.size() ; i++ )
{
PMReal tabpos = iTabStopTable.GetPosition();
LogFile<<
"iTabStopTable[" << i << "].position = " << ToDouble(tabpos)<< endl;
}
//Till here it is working fine, I am able to read existing TabStop values.
//But I am not getting the way to set new TabStop values.
//I tried below code for setting this, but it is not working.
iTabStopTable.clear();
TabStop iTabStop = TabStop();
iTabStop.SetPosition(10);
iTabStopTable.Insert(iTabStop);
compositionStyle->SetTabRuler(iTabStopTable);
Please suggest me way to set new TabStop value to text frame.
Is there any way, so that we can set ICompositionStyle to textframe item.
Waiting for your important suggestions.
Thanks & Regards,
Avinash
