1. Field of the Invention
The present invention relates generally to techniques for editing documents or user interfaces. More specifically, the present invention relates to a method and an apparatus that facilitates a grid-based approach to defining table styles.
2. Related Art
Tables are commonly used to represent information within documents because they can efficiently present information in an intuitive structured format. However, data within tables can sometimes be hard to read. For example, an individual cell within a table can be difficult to distinguish from adjacent cells, especially if the table contains a large number of cells. Furthermore, it is often difficult to trace the column and the row for a given cell back to the corresponding column header and the corresponding row header. Hence, it is often desirable to add attributes, such as cell coloring, to cells within the table which can emphasize and/or distinguish cells from each other, thereby making the contents of the table easier to read.
Table styles can be defined using several techniques. One such technique involves individually setting attributes for each cell within the table. These attributes can include table-level attributes, row-level attributes, cell-level attributes, and text attributes. Table-level attributes can include table dimensions and stroke/border attributes (e.g. width and color of the table/cell border). Row-level attributes can include row height and keep options. (Keep options specify how paragraphs flow across pages or columns within a document. For example, one keep option keeps a first paragraph and a second paragraph on the same page.) Cell-level attributes can include stroke, fill, diagonal lines, cell insets (i.e. the space between the cell border and text within the cell), vertical justification, and text rotation. Text attributes can include paragraph and character attributes.
Another technique for defining table styles involves first selecting a pre-defined pattern, then defining the attributes to use for the pre-defined pattern, and finally applying the pattern of attributes to a target table. For example, Microsoft® Word provides several pre-defined table style patterns which include: whole table, header row, last row, left column, right column, odd row stripes, even row stripes, odd column stripes, even column stripes, top left cell, top right cell, bottom left cell, and bottom right cell. Note that a stripe is a contiguous row or a contiguous column of similar attributes. For example, if the user chooses an odd row stripe pattern, the attributes defined for this pattern is repeated on every cell within an odd-numbered row. Also note that Microsoft® Word enables a user to define a “band” of row/column stripes which allows up to three contiguous rows/columns to contain the same attributes. For example, a user can specify that red is to be applied to alternating rows and that the width of the band should be two rows wide. Hence, the system fills in two rows of red cells, then two rows of white cells (i.e. the default cell background color), then two rows of red cells, etc. in the target table.
Another technique involves applying a custom pattern of attributes to a target area within a spreadsheet application. For example, in the Microsoft®Excel® spreadsheet application, a user can define a pattern of color fills which can then be applied to a target area of the spreadsheet. However, there are several limitations to this technique. First, the target area must be an integer multiple of the area (both in x and y directions) containing the pattern to be tiled or repeated. If the target area is not an integer multiple of the area containing the pattern, the pattern is applied to an area within the target area which occupies exactly the same area as the area of the pattern. Second, not all attributes are applied to the target area. For example, whereas color fills and text attributes are applied to the target area, row heights and column widths are not applied to the target area. (Note that in Microsoft® Excel® 2003, the cell formatting can be copied without copying the contents of the area containing the pattern to be tiled.) Third, there is complete lack of control in applying the pattern to the target area. Changing the area containing the pattern to be tiled does not change the target areas where the pattern was applied (or was re-applied)
Unfortunately, there is no way to generically define a table style which can support all the patterns and attributes for the table or target area. Hence, what is needed is a method and an apparatus for defining and applying table styles to a target table without the problems described above.