Uploaded image for project: 'ODF Toolkit'
  1. ODF Toolkit
  2. ODFTOOLKIT-334

Add new API to support table autoformat

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Implemented
    • 0.5-incubating
    • 0.6-incubating
    • simple api
    • None

    Description

      See previous discussion in the mailing list http://markmail.org/thread/edmejexrfv3m6cdn

      I'd like to propose a new Simple API which could provide a similar function in OpenOffice as ' Table > AutoFormat'. This will allow users to define their own table template once and apply them anywhere they need. Since the <table:table template> doesn't have higher-level support yet, API has to define and extract such template from existing table and serialize them into separated elements at current stage.

      Proposed Solution:
      1. User need to define their own table, as a table template, in a document by ODF editor.
      2. Add two Simple APIs:

      • Need new API to import table style from appointed table.
      • Need new API to apply table style definition to table.

      Since it's difficult to recognize all kinds of style combination, we could use the definition of <table:table template> to define and copy table styles. It means API can recognize and copy 6 types of cell styles from source table to target table.
      1. first column
      2. last column
      3. first row
      4. last row
      5. even rows, odd rows
      6. even columns, odd rows

      Considering performance and complexity, we'd better restrict the size of imported table, basically a 5*5 table (A1:E5) would be enough. We can get each type of style from an appointed cell.
      1. first column ( A2)
      2. last column (E2)
      3. first row (B2)
      4. last row (B5)
      5. even rows (B3), odd rows (B2)
      6. even columns: (C2), odd rows (B2)

      For each type of style, API can copy two definitions <table: style-name> and <table: paragraph-style-name>, which displayed as number format, font, alignment, borders and background.

      In ODF specs, there's some restriction on table template definition. If more than one style reference is applied to a cell, it has to follow the order. It means if a table has even/odd row style, it cannot apply even/odd column style at the same time. Besides that, the four corner cell can only inherit the style from the column or the row they exists, and cannot been appointed to other values. Actually, user may need more complicated template than that, like some complicated template pre-defined in OO. Maybe we could consider more extensibility when defining table template in API according to real requirements.

      Attachments

        1. patch_tabletemplate.patch
          62 kB
          Ke Jia
        2. TableTemplate.odt
          13 kB
          Ke Jia
        3. TestTableTemplate.odt
          12 kB
          Ke Jia

        Activity

          People

            Unassigned Unassigned
            kejia Ke Jia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: