Skip to content

Commit

Permalink
Merge pull request #34 from drmacro/feature/Issue30-cell-border-color
Browse files Browse the repository at this point in the history
Feature/issue30 cell border color
  • Loading branch information
drmacro authored Jan 30, 2021
2 parents 97f9750 + 20c044d commit d27b853
Show file tree
Hide file tree
Showing 10 changed files with 610 additions and 17 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Wordinator

Version 1.0.2
Version 1.0.4

Generate high-quality Microsoft Word DOCX files using a simplified XML format (simple word processing XML).

Expand All @@ -26,6 +26,10 @@ If you need to go from Word documents back to XML, you may find the DITA for Pub

## Release Notes

* 1.0.4

* Issue 29: Support literal callouts and reference callouts for footnotes. Added new attributes to fn element for specifying the callout and, optionally, reference callout text.

* 1.0.3

* Issue 11: Added support for catalog resolution with Saxon. Added new command-line option -k/-catalog that specifies a list of catalog files as for Saxon's -catalog option.
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>org.wordinator</groupId>
<artifactId>wordinator</artifactId>
<packaging>jar</packaging>
<version>1.0.3</version>
<version>1.0.4</version>
<organization>
<name>wordinator.org</name>
<url>https://wordinator.org</url>
Expand Down Expand Up @@ -51,7 +51,7 @@ arbitrary XML, JSON, etc.</description>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -83,7 +83,7 @@ arbitrary XML, JSON, etc.</description>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>10.0</version>
<version>10.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/ooxml-schemas -->
<dependency>
Expand Down
Binary file not shown.
66 changes: 62 additions & 4 deletions src/main/doctypes/simplewpml/simplewpml.rng
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,7 @@
<p>Set foreground color</p>
<p>For now must be an RGB color value, e.g. "C0C0C0". May add support for color names at some point.</p>
</a:documentation>
<data type="string">
<param name="pattern">[0-9A-Fa-f]{6}</param>
</data>
<ref name="hexcolor"/>
</attribute>
</define>
<define name="bookmarkStart">
Expand Down Expand Up @@ -855,7 +853,7 @@
<p>A footnote within a paragraph or run.
Represents the point of reference of the footnote as well as the content of the footnote itself.</p>
<p>A footnote has one or more paragraphs.</p>
<!-- FIXME: May need a way to capture the callout or callout number stream or stream type (e.g., counter format). -->
<p>Issue #29: Added @callout attribute.</p>
</a:documentation>
<zeroOrMore>
<choice>
Expand All @@ -881,6 +879,26 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="callout">
<a:documentation>
<p>Specifies a literal callout to use in place of the normal generated callout.
If only @callout is specified, this value is used for both the reference and
the footnote in the footnote area.</p>
<p>@since: 1.0.4</p>
</a:documentation>
</attribute>
</optional>
<optional>
<attribute name="reference-callout">
<a:documentation>
<p>Specifies the callout to use for the footnot reference when @callout is also
specified. If not specified, the value of @callout is used for the footnote reference
callout.</p>
<p>@since: 1.0.4</p>
</a:documentation>
</attribute>
</optional>
</element>
</define>

Expand Down Expand Up @@ -1325,6 +1343,46 @@
<ref name="borderstyles"/>
</attribute>
</optional>
<optional>
<attribute name="bordercolor">
<a:documentation>
<p>Specifies the border color for the cell's borders.</p>
</a:documentation>
<ref name="hexcolor"/>
</attribute>
</optional>
<optional>
<attribute name="bordercolorbottom">
<a:documentation>
<p>Specifies the bottom border color.</p>
</a:documentation>
<ref name="hexcolor"/>
</attribute>
</optional>
<optional>
<attribute name="bordercolortop">
<a:documentation>
<p>Specifies the top border color.</p>
</a:documentation>
<ref name="hexcolor"/>
</attribute>
</optional>
<optional>
<attribute name="bordercolorleft">
<a:documentation>
<p>Specifies the left border color.</p>
</a:documentation>
<ref name="hexcolor"/>
</attribute>
</optional>
<optional>
<attribute name="bordercolorright">
<a:documentation>
<p>Specifies the right border color.</p>
</a:documentation>
<ref name="hexcolor"/>
</attribute>
</optional>
<optional>
<attribute name="shade">
<a:documentation>
Expand Down
34 changes: 30 additions & 4 deletions src/main/java/org/wordinator/xml2docx/generator/DocxConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
@SuppressWarnings("unused")
public final class DocxConstants {

// Namespace names:
public static final String OO_WPML_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main";
public static final String SIMPLE_WP_NS = "urn:ns:wordinator:simplewpml";

public static final QName QNAME_INSTR_ATT = new QName(OO_WPML_NS, "instr");
// Attributes:
public static final QName QNAME_ALIGN_ATT = new QName("", "align");
public static final QName QNAME_BOLD_ATT = new QName("", "bold");
public static final QName QNAME_BORDER_COLOR_ATT = new QName("", "bordercolor");
public static final QName QNAME_BORDER_COLOR_TOP_ATT = new QName("", "bordercolortop");
public static final QName QNAME_BORDER_COLOR_LEFT_ATT = new QName("", "bordercolorleft");
public static final QName QNAME_BORDER_COLOR_BOTTOM_ATT = new QName("", "bordercolorbottom");
public static final QName QNAME_BORDER_COLOR_RIGHT_ATT = new QName("", "bordercolorright");
public static final QName QNAME_BORDER_STYLE_ATT = new QName("", "borderstyle");
public static final QName QNAME_BORDER_STYLE_BOTTOM_ATT = new QName("", "borderstylebottom");
public static final QName QNAME_BORDER_STYLE_LEFT_ATT = new QName("", "borderstyleleft");
Expand All @@ -31,13 +37,16 @@ public final class DocxConstants {
public static final QName QNAME_BORDER_STYLE_TOP_ATT = new QName("", "borderstyletop");
public static final QName QNAME_BOTTOM_ATT = new QName("", "bottom");
public static final QName QNAME_CALCULATEDWIDTH_ATT = new QName("", "calculatedWidth");
public static final QName QNAME_CALLOUT_ATT = new QName("", "callout");
public static final QName QNAME_CAPS_ATT = new QName("", "caps");
public static final QName QNAME_CHAPTER_SEPARATOR_ATT = new QName("", "chapter-separator");
public static final QName QNAME_CHAPTER_STYLE_ATT = new QName("", "chapter-style");
public static final QName QNAME_CODE_ATT = new QName(SIMPLE_WP_NS, "code");
public static final QName QNAME_COLOR_ATT = new QName(OO_WPML_NS, "color");
public static final QName QNAME_COLSEP_ATT = new QName("", "colsep");
public static final QName QNAME_COLSPAN_ATT = new QName("", "colspan");
public static final QName QNAME_COLWIDTH_ATT = new QName("", "colwidth");
public static final QName QNAME_CUSTOMMARKFOLLOWS_ATT = new QName(OO_WPML_NS, "customMarkFollows");
public static final QName QNAME_DOUBLE_STRIKETHROUGH_ATT = new QName("", "double-strikethrough");
public static final QName QNAME_EMBOSS_ATT = new QName("", "emboss");
public static final QName QNAME_EMPHASIS_MARK_ATT = new QName("", "emphasis-mark");
Expand All @@ -59,6 +68,7 @@ public final class DocxConstants {
public static final QName QNAME_ID_ATT = new QName("", "id");
public static final QName QNAME_IMPRINT_ATT = new QName("", "imprint");
public static final QName QNAME_INSIDEINDENT_ATT = new QName("", "insideindent");
public static final QName QNAME_INSTR_ATT = new QName(OO_WPML_NS, "instr");
public static final QName QNAME_ITALIC_ATT = new QName("", "italic");
public static final QName QNAME_LEFT_ATT = new QName("", "left");
public static final QName QNAME_LEFTINDENT_ATT = new QName("", "leftindent");
Expand All @@ -69,6 +79,7 @@ public final class DocxConstants {
public static final QName QNAME_OUTSIDEINDENT_ATT = new QName("", "outsideindent");
public static final QName QNAME_PAGE_BREAK_BEFORE_ATT = new QName("", "page-break-before");
public static final QName QNAME_POSITION_ATT = new QName("", "position");
public static final QName QNAME_REFERENCE_CALLOUT_ATT = new QName("", "reference-callout");
public static final QName QNAME_RIGHT_ATT = new QName("", "right");
public static final QName QNAME_RIGHTINDENT_ATT = new QName("", "rightindent");
public static final QName QNAME_ROWSEP_ATT = new QName("", "rowsep");
Expand All @@ -91,16 +102,31 @@ public final class DocxConstants {
public static final QName QNAME_VERTICAL_ALIGNMENT_ATT = new QName("", "vertical-alignment");
public static final QName QNAME_WIDTH_ATT = new QName("", "width");
public static final QName QNAME_XSLT_FORMAT_ATT = new QName("", "xslt-format");

// Elements:
public static final QName QNAME_COLS_ELEM = new QName(SIMPLE_WP_NS, "cols");
public static final QName QNAME_COL_ELEM = new QName(SIMPLE_WP_NS, "col");
public static final QName QNAME_FOOTNOTEREF_ELEM = new QName(OO_WPML_NS, "footnoteRef");
public static final QName QNAME_FOOTNOTEREFEREMCE_ELEM = new QName(OO_WPML_NS, "footnoteReference");
public static final QName QNAME_P_ELEM = new QName(SIMPLE_WP_NS, "p");
public static final QName QNAME_W_P_ELEM = new QName(OO_WPML_NS, "p");
public static final QName QNAME_R_ELEM = new QName(OO_WPML_NS, "r");
public static final QName QNAME_ROW_ELEM = new QName(SIMPLE_WP_NS, "row");
public static final QName QNAME_T_ELEM = new QName(OO_WPML_NS, "t"); // w:t -- text element
public static final QName QNAME_THEAD_ELEM = new QName(SIMPLE_WP_NS, "thead");
public static final QName QNAME_TBODY_ELEM = new QName(SIMPLE_WP_NS, "tbody");
public static final QName QNAME_TR_ELEM = new QName(SIMPLE_WP_NS, "tr");
public static final QName QNAME_TD_ELEM = new QName(SIMPLE_WP_NS, "td");
public static final QName QNAME_P_ELEM = new QName(SIMPLE_WP_NS, "p");
public static final QName QNAME_ROW_ELEM = new QName(SIMPLE_WP_NS, "row");
public static final QName QNAME_VSPAN_ELEM = new QName(SIMPLE_WP_NS, "vspan");
public static final String PROPERTY_VALUE_CONTINUOUS = "continuous";

public static final String PROPERTY_VALUE_CONTINUOUS = "continuous";
public static final String PROPERTY_PAGEBREAK = "pagebreak";
public static final QName QNAME_TCPR_ELEM = new QName(OO_WPML_NS, "tcPr");
public static final QName QNAME_TCBORDERS_ELEM = new QName(OO_WPML_NS, "tcBorders");
public static final QName QNAME_TOP_ELEM = new QName(OO_WPML_NS, "top");
public static final QName QNAME_VAL_ATT = new QName(OO_WPML_NS, "val");
public static final QName QNAME_LEFT_ELEM = new QName(OO_WPML_NS, "left");
public static final QName QNAME_RIGHT_ELEM = new QName(OO_WPML_NS, "right");
public static final QName QNAME_BOTTOM_ELEM = new QName(OO_WPML_NS, "bottom");

}
Loading

0 comments on commit d27b853

Please sign in to comment.