First of all thanks..
i try to use the TokenType, but nothing...maybe could be a problem
in the code of the Entry??
This is my code:
[CODE]
mxDocFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(
XMultiServiceFactory.class, xTextDocument);
XPropertySet xEntry=(XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class,
mxDocFactory.createInstance("com.sun.star.text.ContentIndexMark"));
xEntry.setPropertyValue("AlternativeText",titolo_indice);
xEntry.setPropertyValue("Level",new Short ( (short) 1));
XTextContent xEntryContent=(XTextContent)
UnoRuntime.queryInterface(XTextContent.class,xEntry);
Text.insertTextContent(TextCursor,xEntryContent,false);
[/CODE]
xIndex.setPropertyValue("Level",new Short ( (short) 10));
xIndex.setPropertyValue("CreateFromOutline",new Boolean(true));
xIndex.setPropertyValue("IsProtected",new Boolean(false));
XTextContent
xIndexContent=(XTextContent)UnoRuntime.queryInterface(XTextContent.class,xIndex);
XDocumentIndex
xDocIndex=(XDocumentIndex)UnoRuntime.queryInterface(XDocumentIndex.class,xIndex);
xText.insertTextContent(xTextCursor,xIndexContent,false);
XIndexReplace levelFormat=(XIndexReplace) UnoRuntime.queryInterface(
XIndexReplace.class, xIndex.getPropertyValue("LevelFormat") );
for ( int i=0; i<levelFormat.getCount(); i++ )
{
Object oo=levelFormat.getByIndex(i);
PropertyValue[][] propertyvalues = new
PropertyValue[8][];
PropertyValue[] propertyvaluesentry = new
PropertyValue[2];
propertyvalues[0]=propertyvaluesentry;
PropertyValue pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenEntryNumber";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[1]=pv;
propertyvaluesentry = new
PropertyValue[2];
propertyvalues[1]=propertyvaluesentry;
pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenHyperlinkStart";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[1]=pv;
propertyvaluesentry = new
PropertyValue[2];
propertyvalues[2]=propertyvaluesentry;
pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenEntryText";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[1]=pv;
propertyvaluesentry = new
PropertyValue[2];
propertyvalues[3]=propertyvaluesentry;
pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenHyperlinkEnd";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[1]=pv;
propertyvaluesentry = new
PropertyValue[4];
propertyvalues[4]=propertyvaluesentry;
pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenTabStop";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="TabStopRightAligned";
pv.Value=Boolean.TRUE;
propertyvaluesentry[1]=pv;
pv=new PropertyValue();
pv.Name="TabStopFillCharacter";
pv.Value=".";
propertyvaluesentry[2]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[3]=pv;
propertyvaluesentry = new PropertyValue[2];
propertyvalues[5]=propertyvaluesentry;
pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenHyperlinkStart";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[1]=pv;
propertyvaluesentry = new PropertyValue[2];
propertyvalues[6]=propertyvaluesentry;
pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenPageNumber";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[1]=pv;
propertyvaluesentry = new PropertyValue[2];
propertyvalues[7]=propertyvaluesentry;
pv=new PropertyValue();
pv.Name="TokenType";
pv.Value="TokenHyperlinkEnd";
propertyvaluesentry[0]=pv;
pv=new PropertyValue();
pv.Name="CharacterStyleName";
pv.Value="";
propertyvaluesentry[1]=pv;
levelFormat.replaceByIndex ( i, propertyvalues );
}
XPropertySet xIndexProps=(XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class,xDocIndex);
xIndexProps.setPropertyValue("Title","INDICE_AGG");
xDocIndex.update();
[/CODE]
Somewhere there is a problem, but i don't know where..
Peter Eberlein ha scritto:
Hi, Cristian,
Cristian Fonti schrieb:
Hi to all,
I see in the developer's guide how create an index in a writer
document with the JAVA API.
i would add at every page number in the index (or eventually in
the title) a hyperlink to the right section..
I think you have to use the PropertyValue struct TokenType with
its values TokenHyperlinkStart and ~End, as described in the
DevGuide.
I would like to see a code snippet, when you have finished your
examples.
Regards
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]