Documentation
¶
Overview ¶
Package dml provides functionality for working with DrawingML (Drawing Markup Language) which is part of the Office Open XML (OOXML) standard. DrawingML is used to represent graphics and drawings in WordprocessingML, SpreadsheetML, and PresentationML documents.
Index ¶
- type Anchor
- type DocProp
- type Drawing
- type DrawingPositionType
- type EffectExtent
- type Graphic
- type GraphicData
- type GraphicFrameLocks
- type Inline
- type NonVisualGraphicFrameProp
- type PoistionH
- type PoistionV
- type Shape
- func (s Shape) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (s *Shape) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (s *Shape) WithFillColor(color string) *Shape
- func (s *Shape) WithImageData(relationshipID string) *Shape
- func (s *Shape) WithPath(v string) *Shape
- func (s *Shape) WithStrokeColor(color string) *Shape
- func (s *Shape) WithStrokeWeight(weight string) *Shape
- func (s *Shape) WithStyle(style string) *Shape
- func (s *Shape) WithTextBox(content string) *Shape
- type ShapeFill
- type ShapeImageData
- type ShapePath
- type ShapeStroke
- type ShapeTextBox
- type WrapNone
- type WrapPolygon
- type WrapSquare
- type WrapThrough
- type WrapTight
- type WrapTopBtm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anchor ¶
type Anchor struct {
/// Specifies that this object shall be positioned using the positioning information in the
/// simplePos child element (§20.4.2.13). This positioning, when specified, positions the
/// object on the page by placing its top left point at the x-y coordinates specified by that
/// element.
/// Reference: http://officeopenxml.com/drwPicFloating-position.php
//Page Positioning
SimplePosAttr *int `xml:"simplePos,attr,omitempty"`
/// Specifies the minimum distance which shall be maintained between the top edge of this drawing object and any subsequent text within the document when this graphical object is displayed within the document's contents.,
/// The distance shall be measured in EMUs (English Mektric Units).,
//Distance From Text on Top Edge
DistT uint `xml:"distT,attr,omitempty"`
//Distance From Text on Bottom Edge
DistB uint `xml:"distB,attr,omitempty"`
//Distance From Text on Left Edge
DistL uint `xml:"distL,attr,omitempty"`
//Distance From Text on Right Edge
DistR uint `xml:"distR,attr,omitempty"`
//Relative Z-Ordering Position
RelativeHeight int `xml:"relativeHeight,attr"`
//Layout In Table Cell
LayoutInCell int `xml:"layoutInCell,attr"`
//Display Behind Document Text
BehindDoc int `xml:"behindDoc,attr"`
//Lock Anchor
Locked int `xml:"locked,attr"`
//Allow Objects to Overlap
AllowOverlap int `xml:"allowOverlap,attr"`
Hidden *int `xml:"hidden,attr,omitempty"`
// Child elements:
// 1. Simple Positioning Coordinates
SimplePos dmlct.Point2D `xml:"simplePos"`
// 2. Horizontal Positioning
PositionH PoistionH `xml:"positionH"`
// 3. Vertical Positioning
PositionV PoistionV `xml:"positionV"`
// 4. Inline Drawing Object Extents
Extent dmlct.PSize2D `xml:"extent"`
// 5. EffectExtent
EffectExtent *EffectExtent `xml:"effectExtent,omitempty"`
// 6. Wrapping
// 6.1 .wrapNone
WrapNone *WrapNone `xml:"wrapNone,omitempty"`
// 6.2. wrapSquare
WrapSquare *WrapSquare `xml:"wrapSquare,omitempty"`
// 6.3. wrapThrough
WrapThrough *WrapThrough `xml:"wrapThrough,omitempty"`
// 6.4. wrapTopAndBottom
WrapTopBtm *WrapTopBtm `xml:"wrapTopAndBottom,omitempty"`
// 7. Drawing Object Non-Visual Properties
DocProp DocProp `xml:"docPr"`
// 8. Common DrawingML Non-Visual Properties
CNvGraphicFramePr *NonVisualGraphicFrameProp `xml:"cNvGraphicFramePr,omitempty"`
// 9. Graphic Object
Graphic Graphic `xml:"graphic"`
}
func (Anchor) MarshalXML ¶
func (*Anchor) UnmarshalXML ¶
type DocProp ¶
type DocProp struct {
ID uint64 `xml:"id,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
Description string `xml:"descr,attr,omitempty"`
}
func (DocProp) MarshalXML ¶
func (*DocProp) UnmarshalXML ¶
type Drawing ¶
type Drawing struct {
Inline []Inline `xml:"inline,omitempty"`
Anchor []*Anchor `xml:"anchor,omitempty"`
Shape []*Shape `xml:"shape,omitempty"`
}
func (Drawing) MarshalXML ¶
func (*Drawing) UnmarshalXML ¶
type DrawingPositionType ¶
type DrawingPositionType string
const ( DrawingPositionAnchor DrawingPositionType = "wp:anchor" DrawingPositionInline DrawingPositionType = "wp:inline" )
type EffectExtent ¶
type EffectExtent struct {
LeftEdge int64 `xml:"l,attr,omitempty"`
TopEdge int64 `xml:"t,attr,omitempty"`
RightEdge int64 `xml:"r,attr,omitempty"`
BottomEdge int64 `xml:"b,attr,omitempty"`
}
func NewEffectExtent ¶
func NewEffectExtent(left, top, right, bottom int64) *EffectExtent
func (EffectExtent) MarshalXML ¶
func (x EffectExtent) MarshalXML(e *xml.Encoder, start xml.StartElement) error
type Graphic ¶
type Graphic struct {
Data *GraphicData `xml:"graphicData,omitempty"`
}
func DefaultGraphic ¶
func DefaultGraphic() *Graphic
func NewGraphic ¶
func NewGraphic(data *GraphicData) *Graphic
func NewPicGraphic ¶
func (Graphic) MarshalXML ¶
func (*Graphic) UnmarshalXML ¶
type GraphicData ¶
type GraphicData struct {
URI string `xml:"uri,attr,omitempty"`
Pic *dmlpic.Pic `xml:"pic,omitempty"`
}
func (GraphicData) MarshalXML ¶
func (gd GraphicData) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*GraphicData) UnmarshalXML ¶
func (gd *GraphicData) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type GraphicFrameLocks ¶
func (GraphicFrameLocks) MarshalXML ¶
func (g GraphicFrameLocks) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*GraphicFrameLocks) UnmarshalXML ¶
func (g *GraphicFrameLocks) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error
type Inline ¶
type Inline struct {
//Distance From Text on Top Edge
DistT uint `xml:"distT,attr,omitempty"`
//Distance From Text on Bottom Edge
DistB uint `xml:"distB,attr,omitempty"`
//Distance From Text on Left Edge
DistL uint `xml:"distL,attr,omitempty"`
//Distance From Text on Right Edge
DistR uint `xml:"distR,attr,omitempty"`
// Child elements:
// 1. Drawing Object Size
Extent dmlct.PSize2D `xml:"extent,omitempty"`
// 2. Inline Wrapping Extent
EffectExtent *EffectExtent `xml:"effectExtent,omitempty"`
// 3. Drawing Object Non-Visual Properties
DocProp DocProp `xml:"docPr,omitempty"`
//4.Common DrawingML Non-Visual Properties
CNvGraphicFramePr *NonVisualGraphicFrameProp `xml:"cNvGraphicFramePr,omitempty"`
//5.Graphic Object
Graphic Graphic `xml:"graphic,omitempty"`
}
func (Inline) MarshalXML ¶
func (*Inline) UnmarshalXML ¶
type NonVisualGraphicFrameProp ¶
type NonVisualGraphicFrameProp struct {
GraphicFrameLocks *GraphicFrameLocks `xml:"graphicFrameLocks,omitempty"`
}
func (NonVisualGraphicFrameProp) MarshalXML ¶
func (n NonVisualGraphicFrameProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*NonVisualGraphicFrameProp) UnmarshalXML ¶
func (n *NonVisualGraphicFrameProp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type PoistionH ¶
type PoistionH struct {
RelativeFrom dmlst.RelFromH `xml:"relativeFrom,attr"`
PosOffset int `xml:"posOffset"`
}
func (PoistionH) MarshalXML ¶
func (*PoistionH) UnmarshalXML ¶
type PoistionV ¶
type PoistionV struct {
RelativeFrom dmlst.RelFromV `xml:"relativeFrom,attr"`
PosOffset int `xml:"posOffset"`
}
func (PoistionV) MarshalXML ¶
func (*PoistionV) UnmarshalXML ¶
type Shape ¶
type Shape struct {
// Required attributes
ID *string `xml:"id,attr,omitempty"`
Type *string `xml:"type,attr,omitempty"`
// Optional attributes
Style *string `xml:"style,attr,omitempty"`
FillColor *string `xml:"fillcolor,attr,omitempty"`
StrokeColor *string `xml:"strokecolor,attr,omitempty"`
StrokeWeight *string `xml:"strokeweight,attr,omitempty"`
// Child elements
Path *ShapePath `xml:"path,omitempty"`
TextBox *ShapeTextBox `xml:"textbox,omitempty"`
ImageData *ShapeImageData `xml:"imagedata,omitempty"`
Fill *ShapeFill `xml:"fill,omitempty"`
Stroke *ShapeStroke `xml:"stroke,omitempty"`
}
Shape represents a wp:shape element for drawing shapes in Word documents
func (Shape) MarshalXML ¶
MarshalXML marshals the Shape to XML
func (*Shape) UnmarshalXML ¶
UnmarshalXML unmarshals the Shape from XML
func (*Shape) WithFillColor ¶
WithFillColor sets the fill color for the shape
func (*Shape) WithImageData ¶
WithImageData adds image data to the shape
func (*Shape) WithStrokeColor ¶
WithStrokeColor sets the stroke color for the shape
func (*Shape) WithStrokeWeight ¶
WithStrokeWeight sets the stroke weight for the shape
func (*Shape) WithTextBox ¶
WithTextBox adds a textbox element to the shape
type ShapeFill ¶
type ShapeFill struct {
Type *string `xml:"type,attr,omitempty"`
Color *string `xml:"color,attr,omitempty"`
Opacity *string `xml:"opacity,attr,omitempty"`
}
ShapeFill represents fill properties for shapes
func (ShapeFill) MarshalXML ¶
MarshalXML for ShapeFill
func (*ShapeFill) UnmarshalXML ¶
UnmarshalXML for ShapeFill
type ShapeImageData ¶
type ShapeImageData struct {
ID *string `xml:"r:id,attr,omitempty"`
Title *string `xml:"title,attr,omitempty"`
}
ShapeImageData represents imagedata element for shapes containing images
func (ShapeImageData) MarshalXML ¶
func (sid ShapeImageData) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML for ShapeImageData
func (*ShapeImageData) UnmarshalXML ¶
func (sid *ShapeImageData) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML for ShapeImageData
type ShapePath ¶
type ShapePath struct {
V *string `xml:"v,attr,omitempty"`
ConnectType *string `xml:"connecttype,attr,omitempty"`
ConnectLocs *string `xml:"connectlocs,attr,omitempty"`
}
ShapePath represents the path element for vector shapes
func (ShapePath) MarshalXML ¶
MarshalXML for ShapePath
func (*ShapePath) UnmarshalXML ¶
UnmarshalXML for ShapePath
type ShapeStroke ¶
type ShapeStroke struct {
Color *string `xml:"color,attr,omitempty"`
Weight *string `xml:"weight,attr,omitempty"`
DashStyle *string `xml:"dashstyle,attr,omitempty"`
}
ShapeStroke represents stroke properties for shapes
func (ShapeStroke) MarshalXML ¶
func (ss ShapeStroke) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML for ShapeStroke
func (*ShapeStroke) UnmarshalXML ¶
func (ss *ShapeStroke) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML for ShapeStroke
type ShapeTextBox ¶
type ShapeTextBox struct {
Style *string `xml:"style,attr,omitempty"`
// Text content would be WordprocessingML paragraphs
Content string `xml:",innerxml"`
}
ShapeTextBox represents the textbox element for shapes containing text
func (ShapeTextBox) MarshalXML ¶
func (stb ShapeTextBox) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML for ShapeTextBox to set the correct element name
type WrapPolygon ¶
type WrapPolygon struct {
Start dmlct.Point2D `xml:"start"`
LineTo []dmlct.Point2D `xml:"lineTo"`
Edited *bool `xml:"edited,attr,omitempty"`
}
func (WrapPolygon) MarshalXML ¶
func (wp WrapPolygon) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*WrapPolygon) UnmarshalXML ¶
func (wp *WrapPolygon) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type WrapSquare ¶
type WrapSquare struct {
XMLName xml.Name `xml:"wrapSquare"`
//Text Wrapping Location
WrapText dmlst.WrapText `xml:"wrapText,attr"`
//Distance From Text (Top)
DistT *uint `xml:"distT,attr,omitempty"`
//Distance From Text on Bottom Edge
DistB *uint `xml:"distB,attr,omitempty"`
//Distance From Text on Left Edge
DistL *uint `xml:"distL,attr,omitempty"`
//Distance From Text on Right Edge
DistR *uint `xml:"distR,attr,omitempty"`
EffectExtent *EffectExtent `xml:"effectExtent,omitempty"`
}
func (WrapSquare) MarshalXML ¶
func (ws WrapSquare) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*WrapSquare) UnmarshalXML ¶
func (ws *WrapSquare) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type WrapThrough ¶
type WrapThrough struct {
XMLName xml.Name `xml:"wrapThrough"`
//Tight Wrapping Extents Polygon
WrapPolygon WrapPolygon `xml:"wrapPolygon"`
// Text Wrapping Location
WrapText dmlst.WrapText `xml:"wrapText,attr"`
// Distance From Text on Left Edge
DistL *uint `xml:"distL,attr,omitempty"`
// Distance From Text on Right Edge
DistR *uint `xml:"distR,attr,omitempty"`
}
Through Wrapping
func (WrapThrough) MarshalXML ¶
func (w WrapThrough) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*WrapThrough) UnmarshalXML ¶
func (w *WrapThrough) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type WrapTight ¶
type WrapTight struct {
XMLName xml.Name `xml:"wrapTight"`
//Tight Wrapping Extents Polygon
WrapPolygon WrapPolygon `xml:"wrapPolygon"`
// Text Wrapping Location
WrapText dmlst.WrapText `xml:"wrapText,attr"`
// Distance From Text on Left Edge
DistL *uint `xml:"distL,attr,omitempty"`
// Distance From Text on Right Edge
DistR *uint `xml:"distR,attr,omitempty"`
}
Tight Wrapping
func (WrapTight) MarshalXML ¶
func (*WrapTight) UnmarshalXML ¶
type WrapTopBtm ¶
type WrapTopBtm struct {
XMLName xml.Name `xml:"wrapTopAndBottom"`
//Distance From Text (Top)
DistT *uint `xml:"distT,attr,omitempty"`
//Distance From Text on Bottom Edge
DistB *uint `xml:"distB,attr,omitempty"`
//Wrapping Boundaries
EffectExtent *EffectExtent `xml:"effectExtent,omitempty"`
}
Top and Bottom Wrapping
func (WrapTopBtm) MarshalXML ¶
func (w WrapTopBtm) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*WrapTopBtm) UnmarshalXML ¶
func (w *WrapTopBtm) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package dmlct provides complex types related to DrawingML (Drawing Markup Language), which is part of the Office Open XML (OOXML) standard.
|
Package dmlct provides complex types related to DrawingML (Drawing Markup Language), which is part of the Office Open XML (OOXML) standard. |
|
These elements encompass the definition of pictures within the DrawingML framework.
|
These elements encompass the definition of pictures within the DrawingML framework. |
|
Package dml provides simple types used in DrawingML (Drawing Markup Language), part of the Office Open XML (OOXML) standard for representing graphical elements in documents.
|
Package dml provides simple types used in DrawingML (Drawing Markup Language), part of the Office Open XML (OOXML) standard for representing graphical elements in documents. |