Skip to content

Commit

Permalink
Merge branch 'master' into jk/overall-total-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumbiegel authored Sep 20, 2024
2 parents 5c826f7 + 0365bff commit ca8cc3d
Show file tree
Hide file tree
Showing 100 changed files with 62,467 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- **Breaking** Changed `show_overall` keyword of `table_one` to `show_total`. The name of all total columns was changed from `"Overall"` to `"Total"` as well but this can be changed using the new `total_name` keyword.
- Added ability to show "Total" statistics for subgroups in `table_one` [#30](https://github.com/PumasAI/SummaryTables.jl/pull/30).
- Fixed tagging of header rows in docx output, such that the header section is now repeated across pages as expected [#32](https://github.com/PumasAI/SummaryTables.jl/pull/32).

## [2.0.2] - 2024-09-16

Expand Down
11 changes: 6 additions & 5 deletions src/docx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function to_docx(ct::Table)
running_index = 0
tablerows = WriteDocx.TableRow[]

function full_width_border_row(sz)
function full_width_border_row(sz; header = false)
WriteDocx.TableRow(
[WriteDocx.TableCell([WriteDocx.Paragraph([])],
WriteDocx.TableCellProperties(
Expand All @@ -35,11 +35,12 @@ function to_docx(ct::Table)
stop = WriteDocx.TableCellBorder(color = WriteDocx.automatic, size = sz, style = WriteDocx.BorderStyle.none),
),
hide_mark = true,
))]
))],
WriteDocx.TableRowProperties(; header)
)
end

push!(tablerows, full_width_border_row(DOCX_OUTER_RULE_SIZE))
push!(tablerows, full_width_border_row(DOCX_OUTER_RULE_SIZE; header = true))

validate_rowgaps(ct.rowgaps, size(matrix, 1))
validate_colgaps(ct.colgaps, size(matrix, 2))
Expand Down Expand Up @@ -70,10 +71,10 @@ function to_docx(ct::Table)

end
end
push!(tablerows, WriteDocx.TableRow(rowcells))
push!(tablerows, WriteDocx.TableRow(rowcells, WriteDocx.TableRowProperties(; header = ct.header !== nothing && row <= ct.header)))

if row == ct.header
push!(tablerows, full_width_border_row(DOCX_INNER_RULE_SIZE))
push!(tablerows, full_width_border_row(DOCX_INNER_RULE_SIZE; header = true))
end
end

Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Typst_jll = "eb4b1da6-20f6-5c66-9826-fdb8ad410d0e"
ZipFile = "a5390f91-8eb1-5f08-bee0-b1d1ffed6cea"
tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5"

[compat]
Expand Down
267 changes: 267 additions & 0 deletions test/references/annotations/annotated_float.docx.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
############################## [Content_Types].xml ##############################
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types
xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="png" ContentType="image/png" />
<Default Extension="svg" ContentType="image/svg+xml" />
<Default Extension="xml" ContentType="application/xml" />
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" />
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" />
</Types>
############################## _rels/.rels ##############################
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
</Relationships>
############################## word/_rels/document.xml.rels ##############################
<?xml version="1.0" encoding="UTF-8"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
</Relationships>
############################## word/styles.xml ##############################
<?xml version="1.0" encoding="UTF-8"?>
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:docDefaults>
<w:rPrDefault/>
<w:pPrDefault/>
</w:docDefaults>
<w:style w:type="paragraph" w:styleId="Normal">
<w:pPr>
<w:rPr>
<w:sz w:val="20"/>
</w:rPr>
</w:pPr>
<w:name w:val="Normal"/>
<w:link w:val="NormalChar"/>
<w:qFormat/>
</w:style>
<w:style w:type="character" w:styleId="NormalChar">
<w:rPr>
<w:sz w:val="20"/>
</w:rPr>
<w:name w:val="Normal"/>
<w:link w:val="Normal"/>
<w:qFormat/>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading1">
<w:pPr>
<w:rPr>
<w:sz w:val="40"/>
</w:rPr>
<w:spacing w:before="240" w:after="200"/>
</w:pPr>
<w:name w:val="Heading 1"/>
<w:link w:val="Heading1Char"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="character" w:styleId="Heading1Char">
<w:rPr/>
<w:name w:val="Heading 1"/>
<w:link w:val="Heading1"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading2">
<w:pPr>
<w:rPr>
<w:sz w:val="32"/>
</w:rPr>
<w:spacing w:before="200" w:after="160"/>
</w:pPr>
<w:name w:val="Heading 2"/>
<w:link w:val="Heading2Char"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="character" w:styleId="Heading2Char">
<w:rPr/>
<w:name w:val="Heading 2"/>
<w:link w:val="Heading2"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading3">
<w:pPr>
<w:rPr>
<w:sz w:val="28"/>
</w:rPr>
<w:spacing w:before="160" w:after="120"/>
</w:pPr>
<w:name w:val="Heading 3"/>
<w:link w:val="Heading3Char"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="character" w:styleId="Heading3Char">
<w:rPr/>
<w:name w:val="Heading 3"/>
<w:link w:val="Heading3"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading4">
<w:pPr>
<w:rPr>
<w:sz w:val="24"/>
</w:rPr>
<w:spacing w:before="120" w:after="80"/>
</w:pPr>
<w:name w:val="Heading 4"/>
<w:link w:val="Heading4Char"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="character" w:styleId="Heading4Char">
<w:rPr/>
<w:name w:val="Heading 4"/>
<w:link w:val="Heading4"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading5">
<w:pPr>
<w:rPr>
<w:sz w:val="22"/>
<w:i/>
</w:rPr>
<w:spacing w:before="120" w:after="80"/>
</w:pPr>
<w:name w:val="Heading 5"/>
<w:link w:val="Heading5Char"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="character" w:styleId="Heading5Char">
<w:rPr/>
<w:name w:val="Heading 5"/>
<w:link w:val="Heading5"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="paragraph" w:styleId="Heading6">
<w:pPr>
<w:rPr>
<w:sz w:val="20"/>
<w:i/>
</w:rPr>
<w:spacing w:before="120" w:after="80"/>
</w:pPr>
<w:name w:val="Heading 6"/>
<w:link w:val="Heading6Char"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:style w:type="character" w:styleId="Heading6Char">
<w:rPr/>
<w:name w:val="Heading 6"/>
<w:link w:val="Heading6"/>
<w:qFormat/>
<w:basedOn w:val="Normal"/>
</w:style>
<w:latentStyles/>
</w:styles>
############################## word/document.xml ##############################
<?xml version="1.0" encoding="UTF-8"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing">
<w:body>
<w:tbl>
<w:tblPr>
<w:tblCellMar>
<w:top w:w="0"/>
<w:bottom w:w="0"/>
<w:start w:w="30"/>
<w:end w:w="30"/>
</w:tblCellMar>
<w:tblCellSpacing w:w="20"/>
</w:tblPr>
<w:tr>
<w:trPr>
<w:tblHeader/>
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcBorders>
<w:bottom w:val="single" w:color="auto" w:sz="8"/>
<w:end w:val="none" w:color="auto" w:sz="8"/>
<w:start w:val="none" w:color="auto" w:sz="8"/>
</w:tcBorders>
<w:gridSpan w:val="1"/>
<w:hideMark/>
</w:tcPr>
<w:p>
<w:pPr/>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:trPr/>
<w:tc>
<w:tcPr>
<w:tcMar/>
<w:vAlign w:val="top"/>
</w:tcPr>
<w:p>
<w:pPr>
<w:jc w:val="center"/>
</w:pPr>
<w:r>
<w:rPr/>
<w:t>0.124</w:t>
</w:r>
<w:r>
<w:rPr>
<w:vertAlign w:val="superscript"/>
</w:rPr>
<w:t>A</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:trPr/>
<w:tc>
<w:tcPr>
<w:tcBorders>
<w:bottom w:val="single" w:color="auto" w:sz="8"/>
<w:end w:val="none" w:color="auto" w:sz="8"/>
<w:start w:val="none" w:color="auto" w:sz="8"/>
</w:tcBorders>
<w:gridSpan w:val="1"/>
<w:hideMark/>
</w:tcPr>
<w:p>
<w:pPr/>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:trPr/>
<w:tc>
<w:tcPr>
<w:gridSpan w:val="1"/>
</w:tcPr>
<w:p>
<w:pPr/>
<w:r>
<w:rPr>
<w:vertAlign w:val="superscript"/>
</w:rPr>
<w:t>A</w:t>
<w:t xml:space="preserve"> </w:t>
</w:r>
<w:r>
<w:rPr>
<w:sz w:val="16"/>
</w:rPr>
<w:t>Note 1</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:sectPr/>
</w:body>
</w:document>
Loading

0 comments on commit ca8cc3d

Please sign in to comment.