You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by James ARMSTRONG <ja...@q.com> on 2009/10/05 16:56:32 UTC
re: rtflib, table of contents, page citations
I am wondering if anyone can shoot me an example of using RtfLeader (with dots) to create a page citation.
I am using the BasicLink.java example. I am trying to create a simple 1 item TOC that points to a bookmark. I want the area between the link text and the page number to be "dotted". I would like to use the property: text-align-left, which would fill in the space in between the link text and the page number (citation?) to be dotted, but can't seem to find a reference to it in the rtfLib (fop 95).
I don't understand RtfTextrun's and would really appreciate an example of their use.
any help would be greatly appreciated.
James
Here is my code:
// testing ONLLY!!!!
public static void generateDocument() throws IOException {
RtfFile rtfFile = new RtfFile(new FileWriter("C:\\temp\\link.rtf"));
rtfDocumentArea = rtfFile.startDocumentArea();
RtfSection sect = rtfDocumentArea.newSection();
RtfParagraph p = sect.newParagraph();
RtfHyperLink link = p.newHyperLink("Risk Factors", new RtfAttributes());
link.setInternalURL("LINK_TEXT");
RtfTextrun run = link.getTextrun();
run.addLeader(new RtfAttributes()
.set(RtfLeader.LEADER_WIDTH,RtfLeader.LEADER_STANDARD_WIDTH));
run.addPageNumberCitation("1");
run.close();
p.close();
RtfAttributes c = new RtfAttributes();
c.set(RtfText.ALIGN_CENTER);
p = sect.newParagraph(c);
p.newPageBreak();
RtfBookmark bm = p.newBookmark("LINK_TEXT");
RtfAttributes attrs = new RtfAttributes();
attrs.set(RtfText.ATTR_BOLD);
attrs.set(RtfText.ATTR_UNDERLINE);
attrs.set(RtfText.ATTR_FONT_FAMILY, RtfFontManager.getInstance().getFontNumber("Times New Roman"));
attrs.set(RtfText.ATTR_FONT_SIZE, new RTFWriter().getFontSize(14));
p.newText("Risk Factors", attrs);
rtfFile.flush();
System.exit(-1);
}
RE: rtflib, table of contents, page citations
Posted by James ARMSTRONG <ja...@q.com>.
I am sorry. the porperty is text-align-last not left.
James
I am wondering if anyone can shoot me an example of using RtfLeader (with dots) to create a page citation.
I am using the BasicLink.java example. I am trying to create a simple 1 item TOC that points to a bookmark. I want the area between the link text and the page number to be "dotted". I would like to use the property: text-align-left, which would fill in the space in between the link text and the page number (citation?) to be dotted, but can't seem to find a reference to it in the rtfLib (fop 95).
I don't understand RtfTextrun's and would really appreciate an example of their use.
any help would be greatly appreciated.
James
Here is my code:
// testing ONLLY!!!!
public static void generateDocument() throws IOException {
RtfFile rtfFile = new RtfFile(new FileWriter("C:\\temp\\link.rtf"));
rtfDocumentArea = rtfFile.startDocumentArea();
RtfSection sect = rtfDocumentArea.newSection();
RtfParagraph p = sect.newParagraph();
RtfHyperLink link = p.newHyperLink("Risk Factors", new RtfAttributes());
link.setInternalURL("LINK_TEXT");
RtfTextrun run = link.getTextrun();
run.addLeader(new RtfAttributes()
.set(RtfLeader.LEADER_WIDTH,RtfLeader.LEADER_STANDARD_WIDTH));
run.addPageNumberCitation("1");
run.close();
p.close();
RtfAttributes c = new RtfAttributes();
c.set(RtfText.ALIGN_CENTER);
p = sect.newParagraph(c);
p.newPageBreak();
RtfBookmark bm = p.newBookmark("LINK_TEXT");
RtfAttributes attrs = new RtfAttributes();
attrs.set(RtfText.ATTR_BOLD);
attrs.set(RtfText.ATTR_UNDERLINE);
attrs.set(RtfText.ATTR_FONT_FAMILY, RtfFontManager.getInstance().getFontNumber("Times New Roman"));
attrs.set(RtfText.ATTR_FONT_SIZE, new RTFWriter().getFontSize(14));
p.newText("Risk Factors", attrs);
rtfFile.flush();
System.exit(-1);
}