ラベル Format/書式 の投稿を表示しています。 すべての投稿を表示
ラベル Format/書式 の投稿を表示しています。 すべての投稿を表示

2011/08/10

ページ数のリセット その2 (Resetting page number Part 2)


セクションの切り替えによるページ番号のリセットについて、OTNに質問されていました。
http://forums.oracle.com/forums/thread.jspa?threadID=2260685

紹介されている例では、forループに@sectionを設定することでページ番号をリセットします。emp表のdeptno毎にセクションを区切って表示する場合、構文は以下の通りです。
<?for-each-group@section:ROW;./DEPTNO?>


過去に「ページ数のリセット」にて initial-page-number を使用したページ番号の切り替えを説明しましたが、グループの単位と改ページ・セクションの単位が同じ場合には、こちらの方法がよりシンプルに制御できます。


[Summary]
With @section, you can initialize the page number on the start of each group.
<?for-each-group@section:ROW;./DEPTNO?>


OTN:
http://forums.oracle.com/forums/thread.jspa?threadID=2260685


Also, please refer to the following post.  It explains  initial-page-number.
Resetting page number

2011/05/27

ページ数のリセット (Resetting page number)

RTFテンプレートでセクションを分割した場合、セクション毎にページ番号をリセットしたいという要件があります。
または、月次のレポート出力において、ページ数を累積して出力したい(つまり、最初のページが1ではなく、たとえば30ページから開始する等)という要件も考えられます。

このような要件に対しては、initial-page-number を使用します。以下の例では、ページ番号は30ページから開始します。
<?initial-page-number:’30’?>

または、セクション区切りの後に以下のコードを埋め込むことで、ページは1から再開します。
<?initial-page-number:’1’?>


データフィールドの値を使用する場合は、以下の様に直接記載します。
<?initial-page-number:DEPTNO?>


詳細は以下のマニュアルを参照して下さい。
http://download.oracle.com/docs/cd/E14571_01/bi.1111/e13881/T421739T481157.htm#T481182


なお上記マニュアルによれば、この機能はPDFおよびPPT形式の出力でのみ、サポートされるようです。


[Summary]
initial-page-number resets, or setup the start number of the section.  If you want to start the report from 30, instead of 1, you set:
<?initial-page-number:’30’?>

If you simply want to reset the page number by the section, set '1' after the section break.
<?initial-page-number:’1’?>


To apply data field, write its name as follow:
<?initial-page-number:DEPTNO?>


2011/05/26

MS-Wordでのページ設定 (Page setup on MS-Word)

BI Publisher はMS-Wordでのページ設定、セクション区切りもサポートしています。
セクションはそれぞれ異なるページ設定(用紙サイズ、用紙の向き、ヘッダ/フッタ)を行うことができます。これにより、レポート内で用紙サイズや向きを変更する要件にも、ある程度容易に対応できます。

以下の例では、最初の2枚のページと3ページ目以降でセクションを分割しています。最初のセクションはA4縦、2つ目のセクションはA3横の設定で、それぞれ異なるヘッダ定義です。

Figure 1: two sections


セクションの操作について、詳細はマイクロソフト社のサポートページを参照してください。
http://office.microsoft.com/ja-jp/word-help/CH006082987.aspx


上記のサンプルのテンプレートはここからダウンロードできます。


[Sumarry]
BI Publisher supports MS-Word page setting functions - header and footer, and sections.
You can specify the page setup (size, alignment, margine, header and footer, and so on) on each sections individually.  This feature will fill your customer's requirement much easier.
Figure 1 shows the result.  The first page and the second page are in section 1.  They are in A4 vertical page layout.  The third and the fourth page are in section 2.  This section is A3 horizontal.  Its header is differ from the section 1.


Please refer the Microsoft support site for more information.
http://office.microsoft.com/en-us/word-help/understanding-page-section-formatting-book-excerpt-HA001187601.aspx


You can get the rtf template from here.

2011/05/24

ページによるヘッダ・フッタの切り替え (Switching the header / footer contents)

ヘッダとフッタをページに応じて切り替える、という要件は古くも新しい話題です。
US-OTNでも何度も話題に上がっていますが、そのほとんどにおいて最初のページと最後のページのヘッダおよびフッタの扱いが問題となっています。

BI Publisher ではヘッダおよびフッタ領域の区切りとして以下のタグを提供しています。
<?start:body?><?end body?>
<?start@last-page:body?><?end body?>
<?start@last-page-first:body?><?end body?>

しかし、これらだけでは、たとえば以下のような要件を満たすことはできません。
  • 最初のページ、中間のページ、および最後のページでヘッダ・フッタを切り替える
  • 内容が1ページに収まる場合には、最初のページのヘッダ最後のページのフッタを出力する

【具体例】
上記の要件の具体例を以下に示します。

先頭のページには文字列 First page header、および First page footer が出力されます。

Figure 1: page 1 of 3 (First page)


2番目の(中間の)ページには、文字列 Middle page header、および Middle page footer が出力されます。
Figure 2: page 2 of 3 (Middle page)

最後のページには文字列 Last page header、および Last page footer が表示されます。
Figure 3: page 3 of 3 (Last page)


また、このレポートが1ページに収まる場合の出力は以下の通りです。ヘッダには文字列 First page header を表示しつつ、フッタには Last page footer が出力されます。

Figure 4: Single page (The first page is the last page)

【xdofo:inline-total】
上記のような要件を満たすには、xdofo:inline-total オブジェクトを使用します。本来、このオブジェクトはページ間で数値の累計を受け渡す為のものですが、ヘッダおよびフッタの切り替えに使用することもできます。

xdofo:inline-total に定義されている表示条件(display-condition)は以下の通りです。
  • first
  • last
  • exceptfirst
  • exceptlast
  • everytime (デフォルト)


マニュアルは以下のURLにて参照できます。
http://download.oracle.com/docs/cd/E14571_01/bi.1111/e13881/T421739T481157.htm


テンプレートをこちらに用意しました。

構文を以下に説明します。

以下の設定は、最初のページのみに現れるヘッダを定義しています。
<xdofo:inline-total display-condition="first" name="vDummy">
First page header
</xdofo:inline-total>


以下の設定は、中間のページのヘッダを定義しています。 exceptfirstとexceptlastをネストすることで、中間のみの出力を実現します。
<xdofo:inline-total display-condition="exceptfirst" name="vDummy">
<xdofo:inline-total display-condition="exceptlast" name="vDummy">
Middle page header
</xdofo:inline-total>
</xdofo:inline-total>


以下の設定は、最後のページのヘッダを定義しています。exceptfirstをネストして定義することで、レポートが1ページのみの場合に非表示になります。
<xdofo:inline-total display-condition="last" name="vDummy">
<xdofo:inline-total display-condition="exceptfirst" name="vDummy">
last page header
</xdofo:inline-total>
</xdofo:inline-total>



以下の設定は、最初のページのフッタを定義しています。exceptlastをネストして定義することで、レポートが1ページのみの場合に非表示になります。
<xdofo:inline-total display-condition="first" name="vDummy">
<xdofo:inline-total display-condition="exceptlast" name="vDummy">
First page footer
</xdofo:inline-total>
</xdofo:inline-total>


以下の設定は、最後のページのフッタを定義しています。レポートが1ページのみの場合、最初のページが最後のページにもなるため、表示されます。
<xdofo:inline-total display-condition="last" name="vDummy">
Last page footer
</xdofo:inline-total>


【制限事項】
xdofo:inline-totalはPDFのフォーマッティング時に実行されるため、PDF以外の出力では使用できません。また、テンプレートの呼び出しなどはフォーマッティング以前に完了される必要があるため、xdofo:inline-total内に記載することはできません。
フォーマッティング時に実行される fo:page-number 等のオブジェクトは使用できます。つまり、以下の記載は有効です。
<xdofo:inline-total display-condition="last" name="vDummy">
<fo:page-number()>
</xdofo:inline-total>




[Summary]
The example above shows how to switch the header and footer based on the page condition. In many cases, The first page becomes the last page (i.e. the report is one page only) raise a problem.


BI Publisher provides header/footer solutions such as <?start:body?>, but its function is not strong enough to fill the customer's requirement.


[Requirements]
Figure 1 through to Figure 4 shows the typical requirement.
If report has several pages, it shows different header / footer on the first, middle and the last page (Figure 1 to 3).
If report is only one page, it shows the first page header and the last page footer (Figure 4).


[xdofo:inline-total object]
To fill the requirement above, use xdofo:inline-total object. You can use it with the nested construct.
The sample rtf template is available here.


For the details, please refer the manual below:


[Restriction]
Since xdofo:inline-total is extracted in PDF formatting phase, other format - RTF, Excel etc - is not supported.
Things that need to be organized before the PDF formatting phase, such as calling template, cannot be included in xdofo:inline-total object.

2011/02/28

マイナスの書式設定 (Format: Negative number)

数値型がマイナスの場合の書式設定について、US OTNおよびブログで紹介されています。


参考URL:
http://forums.oracle.com/forums/thread.jspa?threadID=693945&tstart=0
http://winrichman.blogspot.com/2008/08/display-negative-numbers-in-braces.html



MS-Wordのフィールドプロパティで設定するのが楽だろうという話の他、以下の構文も紹介されています。xdofx:if 構文は、簡単な値補正にも使用できます。

<xdofx:if SALES > 0 then SALES else '('|| SALES ||')' end if>
<?format-number(SALES, '#,##0;(#,##0)')?>


一応、「#,##0;▲#,##0」が正しく動作するか確認しました。問題ありませんでした。


[ Summary ]
How to display Negative numbers in Braces "( )" - use the formulas above, or,  set that form-field as Number type, and type the mask string on MS-Word.
Refer the URLs for more details.