Comments (5)
Appologies, I just stumbled onto the SetColumnSpan
method on cell.Properties()
: https://github.com/baliance/gooxml/blob/master/document/cellproperties.go#L28
So looks like merging cells is already implemented. I'll leave this open for feedback on table styles.
from unioffice.
@freb You may want to check out baliance.com/gooxml/_examples/document/tables
if you haven't already, it has an example of SetColumnSpan
. I'll update the document to mention the phrase 'merged cells' to help in future users that search for it.
Adding support for table styles is pretty trivial from the table side, it's just allowing setting the style and some attributes on the 'look'. (Though that val in tblLook is apparently a 'Bitmask of Table Conditional Formatting', that I'd need to research). I can probably knock that out in the next day or so.
<w:tblStyle w:val="PlainTable1"/>
<w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
It would take a bit longer to finish fleshing out the styles with support for table to allow you to create something like this:
<w:style w:type="table" w:styleId="PlainTable1">
<w:name w:val="Plain Table 1"/><w:basedOn w:val="TableNormal"/>
<w:uiPriority w:val="41"/>
<w:rsid w:val="00811EB9"/>
<w:tblPr>
<w:tblStyleRowBandSize w:val="1"/>
<w:tblStyleColBandSize w:val="1"/>
<w:tblInd w:w="0" w:type="dxa"/>
<w:tblBorders>
<w:top w:val="single" w:sz="4" w:space="0" w:color="BFBFBF" w:th
emeColor="background1" w:themeShade="BF"/><w:left w:val="single" w:sz="4" w:spac
e="0" w:color="BFBFBF" w:themeColor="background1" w:themeShade="BF"/>
<w:bottom w:val="single" w:sz="4" w:space="0" w:color="BFBFBF" w
:themeColor="background1" w:themeShade="BF"/>
<w:right w:val="single" w:sz="4" w:space="0" w:color="BFBFBF" w:
themeColor="background1" w:themeShade="BF"/>
<w:insideH w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"
w:themeColor="background1" w:themeShade="BF"/>
<w:insideV w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"
w:themeColor="background1" w:themeShade="BF"/>
</w:tblBorders>
<w:tblCellMar>
<w:top w:w="0" w:type="dxa"/>
<w:left w:w="108" w:type="dxa"/>
<w:bottom w:w="0" w:type="dxa"/>
<w:right w:w="108" w:type="dxa"/>
</w:tblCellMar>
</w:tblPr>
<w:tblStylePr w:type="firstRow">
<w:rPr>
<w:b/><w:bCs/>
</w:rPr>
</w:tblStylePr>
<w:tblStylePr w:type="lastRow">
<w:rPr>
<w:b/><w:bCs/>
</w:rPr>
<w:tblPr/>
<w:tcPr>
<w:tcBorders>
<w:top w:val="double" w:sz="4" w:space="0" w:color="BFBFBF" w:themeColor="background1" w:themeShade="BF"/>
</w:tcBorders>
</w:tcPr>
</w:tblStylePr>
<w:tblStylePr w:type="firstCol">
<w:rPr>
<w:b/><w:bCs/>
</w:rPr>
</w:tblStylePr>
<w:tblStylePr w:type="lastCol">
<w:rPr>
<w:b/><w:bCs/>
</w:rPr>
</w:tblStylePr>
<w:tblStylePr w:type="band1Vert">
<w:tblPr/>
<w:tcPr>
<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2" w:themeFill="background1" w:themeFillShade="F2"/>
</w:tcPr>
</w:tblStylePr>
<w:tblStylePr w:type="band1Horz">
<w:tblPr/>
<w:tcPr>
<w:shd w:val="clear" w:color="auto" w:fill="F2F2F2" w:themeFill="background1" w:themeFillShade="F2"/>
</w:tcPr>
</w:tblStylePr>
</w:style>
from unioffice.
Sorry about the SetColumnSpan
, I found that a short while after posting.
For my use case, I don't have much interest in being able to generate a table style from scratch. I'll always be working off of at least a dotx
file where it would be a lot easier to generate the style in Word for use with gooxml. Being able to easily set the style on the table would be nice though.
from unioffice.
@freb Using predefined styles is in master now, see document/use-template for an example. I created #131 to track creating table styles from scratch.
from unioffice.
This looks awesome. I'll let you know if I run into any issues. Thanks!
from unioffice.
Related Issues (20)
- Is this still Open Source software? HOT 3
- Cannot insert table correctly HOT 3
- Feature request: Animations for PowerPoint HOT 1
- nil pointer when convert docx to pdf HOT 9
- Runtime error extracting text from Word document HOT 3
- No text in document after converting a Word document to PDF HOT 3
- How to split a run and/or paragraph while preserving styling HOT 3
- No text extracted from PowerPoint file HOT 2
- how to get the real content contained in the specified bookmark HOT 2
- AppProperties.Pages() doesn't always return the correct number of pages HOT 2
- Convert `.docx` to `.pdf` misses images HOT 2
- How to get the page size for a Word doc? HOT 7
- is there support for adding a comment to a word doc? HOT 1
- Unit tests? HOT 2
- Why do proofreading errors occur HOT 5
- panic: runtime error: index out of range [0] with length 0 while converting docx to pdf HOT 1
- May I ask if there is an implementation for inserting chart elements into pptx? HOT 1
- How to insert a table at a specified location in a word document HOT 2
- Are all Unidoc projects fully open source? HOT 2
- Chinese characters, a null pointer error will occur. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unioffice.