Talk:Kexi/Plugins/Reports

From KDE Community Wiki
Revision as of 18:54, 15 December 2010 by Jstaniek (talk | contribs) (Created page with 'Discussion about xml format for reports. __TOC__ ==Page Sizes== At the moment, only predfined page sizes such as A4, letter etc are allowed. They are specified as: <size>A4</...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Discussion about xml format for reports.

Page Sizes

At the moment, only predfined page sizes such as A4, letter etc are allowed. They are specified as:

<size>A4</size>a

The aim is to also allow for custom page sizes and predefined label formats. For this i propose expanding the <size> tag to allow:

<size width=X height=Y>custom</size>

and

<size labeltype="type">label</size>

As with all other sizes in the xml format, X and Y in the custom size variant will be specified in points, and the label sizes will be taken from common/labelsizeinfo.cpp, which currently contains:

  • Avery 5263
  • Avery 5264
  • Avery 8460,
  • CILS ALP1-9200-1

I propose to look at the ODF 1.1 specs

In particular style:page-layout element (14.3 Page Layout). You can also create some odt files and look at styles.xml.

Example:

   <style:page-layout style:name="pm1">
     <style:page-layout-properties fo:page-width="20.999cm" fo:page-height="29.699cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2.499cm" fo:margin-bottom="2.499cm" fo:margin-left="2.499cm" fo:margin-right="2.499cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="38" style:layout-grid-base-height="0.388cm" style:layout-grid-ruby-height="0.247cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm">
       <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
     </style:page-layout-properties>
     <style:header-style/>
     <style:footer-style/>
   </style:page-layout>

It could be cool (!) to reuse some of these elements. Please note that apparently ODF does not define names for the page sizes e.g. A4, A5. We can add them if needed. As you can see attributes are used heavily here, what's quite good idea.

If you paste examples of your current xml (my tests may not cover all cases - as you know better), I may be able to propose replacement xmls for particular elements, where needed, to harmonize with ODF.

--Jstaniek 6 December 2009

Sample

See http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html for fo: attrs

<report:content xmlns:report="http://kexi-project.org/report/2.0" 
 xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0">
 <report:title>Report</report:title>
 <report:scripts report:interpreter="javascript"/>
 <report:page-layout-properties report:print-orientation="portrait" fo:margin-top="28.34mm" 
   fo:margin-bottom="28.34mm" fo:margin-right="28.34mm" fo:margin-left="28.34mm"/>
 <report:body>
   <report:section report:section-type="details" svg:height="70.86mm" fo:background-color="#ffffff" report:background-opacity:"1.0" />
 </report:body>
</report:content>

report:background-opacity is added after CSS 3, for reports as custom attr (there's no standard in fo) --jstaniek

More proposals

1. Proposed values of report:section-type to make them english names:

  • first-page-header
  • odd-page-header
  • even-page-header
  • last-page-header
  • any-page-header
  • report-header
  • report-footer
  • first-page-footer
  • odd-page-footer
  • even-page-footer
  • last-page-footer
  • any-page-footer
  • group-header
  • group-footer
  • detail

2. I also propose report:group-level attr of type uint, which would apply to section descriptions when report:section-type is one of these: group-header, group-footer, detail.

3. In the API, I also propose to change/normaliz KRSectionData::Section enums to a more Qt-API compliant shape:

  enum Section {
       NoSection = 0,
       FirstPageHeaderSection,
       OddPageHeaderSection,
       EvenPageHeaderSection,
       LastPageHeaderSection,
       AnyPageHeaderSection,
       ReportHeaderSection,
       ReportFooterSection,
       FirstPageFooterSection,
       OddPageFooterSection,
       EvenPageFooterSection,
       LastPageFooterSection,
       AnyPageFooterSection,
       GroupHeaderSection,
       GroupFooterSection,
       DetailSection
   };

jstaniek 15:24, 9 December 2009 (PST)