mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-20 17:40:33 +08:00
优化table attr
This commit is contained in:
@@ -164,12 +164,14 @@ func (t *WTableProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement)
|
|||||||
// and vertical anchors, distance from text, and coordinates.
|
// and vertical anchors, distance from text, and coordinates.
|
||||||
type WTablePositioningProperties struct {
|
type WTablePositioningProperties struct {
|
||||||
XMLName xml.Name `xml:"w:tblpPr,omitempty"`
|
XMLName xml.Name `xml:"w:tblpPr,omitempty"`
|
||||||
LeftFromText int `xml:"w:leftFromText,attr"`
|
LeftFromText int `xml:"w:leftFromText,attr,omitempty"`
|
||||||
RightFromText int `xml:"w:rightFromText,attr"`
|
RightFromText int `xml:"w:rightFromText,attr,omitempty"`
|
||||||
VertAnchor string `xml:"w:vertAnchor,attr"`
|
VertAnchor string `xml:"w:vertAnchor,attr,omitempty"`
|
||||||
HorzAnchor string `xml:"w:horzAnchor,attr"`
|
HorzAnchor string `xml:"w:horzAnchor,attr,omitempty"`
|
||||||
TblpX int `xml:"w:tblpX,attr"`
|
TblpXSpec string `xml:"w:tblpXSpec,attr,omitempty"`
|
||||||
TblpY int `xml:"w:tblpY,attr"`
|
TblpYSpec string `xml:"w:tblpYSpec,attr,omitempty"`
|
||||||
|
TblpX int `xml:"w:tblpX,attr,omitempty"`
|
||||||
|
TblpY int `xml:"w:tblpY,attr,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalXML ...
|
// UnmarshalXML ...
|
||||||
@@ -190,6 +192,10 @@ func (tp *WTablePositioningProperties) UnmarshalXML(d *xml.Decoder, start xml.St
|
|||||||
tp.VertAnchor = attr.Value
|
tp.VertAnchor = attr.Value
|
||||||
case "horzAnchor":
|
case "horzAnchor":
|
||||||
tp.HorzAnchor = attr.Value
|
tp.HorzAnchor = attr.Value
|
||||||
|
case "tblpXSpec":
|
||||||
|
tp.TblpXSpec = attr.Value
|
||||||
|
case "tblpYSpec":
|
||||||
|
tp.TblpYSpec = attr.Value
|
||||||
case "tblpX":
|
case "tblpX":
|
||||||
tp.TblpX, err = strconv.Atoi(attr.Value)
|
tp.TblpX, err = strconv.Atoi(attr.Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -375,8 +381,8 @@ func (g *WGridCol) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err err
|
|||||||
// WTableRow represents a row within a table.
|
// WTableRow represents a row within a table.
|
||||||
type WTableRow struct {
|
type WTableRow struct {
|
||||||
XMLName xml.Name `xml:"w:tr,omitempty"`
|
XMLName xml.Name `xml:"w:tr,omitempty"`
|
||||||
RsidR string `xml:"w:rsidR,attr"`
|
RsidR string `xml:"w:rsidR,attr,omitempty"`
|
||||||
RsidTr string `xml:"w:rsidTr,attr"`
|
RsidTr string `xml:"w:rsidTr,attr,omitempty"`
|
||||||
TableRowProperties *WTableRowProperties
|
TableRowProperties *WTableRowProperties
|
||||||
TableCells []*WTableCell
|
TableCells []*WTableCell
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ import (
|
|||||||
//
|
//
|
||||||
// 1. Document
|
// 1. Document
|
||||||
// 2. Relationships
|
// 2. Relationships
|
||||||
|
// 3. Media
|
||||||
|
//
|
||||||
|
// Then it stores all other files into tmpfslist for packing.
|
||||||
func unpack(zipReader *zip.Reader) (docx *Docx, err error) {
|
func unpack(zipReader *zip.Reader) (docx *Docx, err error) {
|
||||||
docx = new(Docx)
|
docx = new(Docx)
|
||||||
docx.mediaNameIdx = make(map[string]int, 64)
|
docx.mediaNameIdx = make(map[string]int, 64)
|
||||||
|
|||||||
Reference in New Issue
Block a user