Different odd & even Header / Footer by Section in Word - vba

I'm trying to figure out how to code headers and footers by sections and different even and odd pages, with a different cover. I'm looking to create something like this format:
Cover
No header or footer
Section 1
Odd Pages:
Header 1
Body
Footer 1 Date
File name, Page #
Even Pages:
Header 1
Body
Date Footer 1
File name, Page #
Section 2
Use the header and footer alternating pattern from Section 1 but with different Header text
Is this possible? Thanks in advance!

Related

Netsuite PDF Templating: get number of pages as attribute

I am templating pdfs in Netsuite using freemarker and I want to display the footer only on the last page. I have been doing some research, but couldn't find a solution (since looks like the environment does not allow me to include or import libs), so I thought that just comparing the number of the page with the total pages in an if tag would be a nice and easy workaround. I already know how to display the numbers by using the <pagenumber/> and <totalpages/> tags, but still cannot get them as values so I can use them like this:
<#if (pagenumber == totalpages) >
... footer html...
</#if>
Any ideas of how or where can I get those values from?
The approach you are trying won't work, because you are mixing BFO and Freemarker syntax. Netsuite uses two different "engines" to process PDF Templates. The first step is Freemarker, which merges the record fields with your template and produces an XML file, which is then converted by BFO into a PDF file. The <totalpages/> element is meaningless to Freemarker, as it is only converted into a number by BFO later.
Unfortunately, the ability to add a footer to only the last page of a document is currently a limitation of BFO, as per the BFO FAQ:
At the moment we do not have a facility for explicitly assigning a
footer or header to the last page in a document when the number of
pages is unknown.
You CAN add it after a page break - and put the page break at the end of the body
<pbr footer="nlfooter" footer-height="25%"></pbr>
</body>
The issue here is - on a one page output - you will get 2 pages minimum... it will always ADD a page for the disclaimer / footer...

Section content using MediaWiki API

I'm using the MediaWiki API to get the content of a Wikipedia page like this in JSON.
http://en.wikipedia.org/w/api.php?format=json&action=query&titles=New_York&prop=extracts
I'd like each section to be separated out instead of having the entire content of the page as one value. I know you can get each section like this but I want it to also include the content with each section.
http://en.wikipedia.org/w/api.php?format=json&action=parse&prop=sections&page=New_York
Is this possible to do with the API?
If you know the number of the section which you want you can get the contents through action=parse with the section parameter. E.g. the "19th century" section of the New_York article would be:
https://en.wikipedia.org/w/api.php?action=parse&page=New_York&format=json&prop=wikitext&section=4
To get the section number you can use
http://en.wikipedia.org/w/api.php?format=json&action=parse&prop=sections&page=New_York
and then find the index corresponding to your section title (line). In this case "line":"19th century","index":"4".

How to detect a section in a wikimedia page dump

I have looked around quite a bit to try and answer this question, but to no avail. I am parsing wikimedia page dumps to process certain pages (yes, I am aware of several tools to parse wikimedia page dumps, but they don't work for me as well as my parser).
Question is simple. I know how to detect start of a section (e.g. "==External References=="). That's easy. What's not well defined is how to detect when a section ends? For example, for most sections I can scan until start of next section header, but that isn't reliable. I looked at wikimedia's help page on sections, but it doesn't say how to detect end of a section.
There is no "section end" marker in MediaWiki syntax. A section extends until the next section header of the same or lower level. (There is also a "section 0" containing all the text before the first section header.)
Yes, this implies that sections at different levels can overlap, as in this example:
This text is in section 0.
== Section 1 begins here ==
This text is in section 1.
=== Section 2 begins here ===
This text is in sections 1 and 2.
=== Section 3 begins here ===
This text is in sections 1 and 3.
== Section 4 begins here ==
This text is in section 4.
Note that headings created using the HTML <h1>, <h2>, etc. tags don't begin or end sections, and won't have section edit links, even though they look otherwise identical to section headings.
Section headings inside templates do get section edit links, which let you edit the corresponding section of the template, but they're treated specially and are not considered part of the normal section structure of the containing page. There are also some weird special cases here involving section headers inside template parameters which I don't fully remember off the top of my head.
The automatically generated first level heading at the top of every page also doesn't count as a section heading, although any extra first level headings created with = Heading = do.

How to suppress a page header on page header and first page of a group?

I have a report where each group is about 5-7 pages long.
I need to suppress the page header on the first page of each group
Also I want to Supress the header on each group change (on first age on group)
Note : I don't want to reset page no after each group change.
I found solution for point 1 :
Crystal Reports - How to suppress a page header on the first page of a group?
Now I am looking for point 2 solution.
How can I do this? Please Help.
You can also supress Group header same as Page header but you have to add condition for that like
Boolean RetValue=false;
If(GroupNo==OldGroupNo)
RetValue=True;
Return RetValue;
In this OldGroupNo is Shared Variable which change in WhilePrintingRecord Function in Detail Section. You have to manage OldGroupNo In Detail section and then supress it.
May be this Help to you.....

Set the header for PDF document on second page

I have a jsp page that contains some data(This data may very because it is fetches from the data base) over it.Now I am generating the PDF file for the my jsp page using the ‘Itext api’ . Now I need to set the some specific header on this generated pages started from the Page 2 onwards.
For Ex :-
Test.jsp
Jsp test page contains the data for testing purpose.
Test.pdf
Jsp test page contains the data for testing purpose.
……
…
Page 1 ends
Page 2 starts
My title for the page..(Only needed for the second page onwards)**
Please help me...
Thanks in advance
You can probably make use of setSkipFirstHeader(boolean) of PdfPTable. Which will not print out the first occurrence of the header of your table. You will need to be sure to setHeaderRows on the table.
You could also subclass the PdfPageEventHelper and in the onEndPage event, use the passed in Document object to getPageNumber(). When you determine it is past the first page, you can add your header content to the document.