Wednesday, January 23, 2013

Combined Running Page and Reset Page Numbers


I had a problem that a client wanted a report such that the page number in the header would reset every time there was a new order number.  At the same time, the client wanted a running page number on the footer.

This was tricky because it is easy to have one or the other but not both.  Hok Min (sp?) from Oracle Product Support provided me with a solution.  Here his the code he gave me:

 <fo:page-number xdofo:report-page-number="true"/>

The problem with using this code is that for it to work, it has to go in a form field.  This presents a problem because headers and footers cannot have form fields in an RTF template.  The work around is to define a subtemplate and to call the subtemplate from the footer.  Understand that subtemplates do not have to be on a separate RTF template but they can exist on the same RTF template.  When I do it this way, I usually put the definitions at the end of the RTF template that I am working on.

Here is the definition of the subtemplate:

<?template:pageno?>TotPageNo<?end template?>

The form field contains the code above in the blue text.

Now to use it in a footer:


--------------------------------------------------------------------------------------
footer section
                                            <?call:pageno?>


Tuesday, January 22, 2013

For Loops

For Loops

There are some instances that you may want to have a for loop and not have it driven by the XML data coming in.

It is in the user guide in the section where shapes are discussed but it is not elaborated at all.  I used it in my "Dynamic Formatting" blog.

Here is the construct of the loop:


<?for-each@inlines:xdoxslt:foreach_number($_XDOCTX,1,3,1)?><-some text-><?end for-each?>

$_XDOCTX,1,3,1 - This number will be the start of the count.
$_XDOCTX,1,3,1 - The loop ends when this number is reached.
$_XDOCTX,1,3,1 - This number is used as the increment of the count.

The output of the above example will be:  <-some text-><-some text-><-some text->

If you remove the @inlines then the output text will be:
<-some text->
<-some text->
<-some text->

Instead of hard coding the three numbers, a variable can be used in one or more places.


BI Publisher MS Word Add-in: The macro cannot be found or has been disabled because of your macro security settings

All of a sudden your MS Word Add-in will quit working with this error message:  The macro cannot be found or has been disabled because of your macro security settings.

Windows Common Control-based embedded ActiveX controls may fail to load within pre-existing Office documents, within third-party add-ins, and when you insert new controls in developer mode. 

This was caused by the MSCOMCTL.OCX file not being registered properly after after an MS Office security update.

You will look on the web and find all kinds of gyrations that they make you do but it is not necessary.  

This is all you have to do:

Note You must run the commands from commands at an elevated command prompt with administrator permissions. To do this, follow these steps:
  1. Click Start, type cmd.
  2. Right-click the cmd icon, and then click Run as Administrator.
  3. Depending on your operating system, type the either of the following commands, and then press Enter:
    • For 64-bit operating systems, type the following:
      Regsvr32 "C:\Windows\SysWOW64\MSCOMCTL.OCX"
    • For 32-bit operating systems, type the following:
      Regsvr32 "C:\Windows\System32\MSCOMCTL.OCX"