@@ -13,8 +13,8 @@ import (
13
13
"strings"
14
14
)
15
15
16
- // AddPicture provide the method to add picture in a sheet by given xAxis, yAxis and file path.
17
- // For example:
16
+ // AddPicture provide the method to add picture in a sheet by given xAxis, yAxis
17
+ // and file path. For example:
18
18
//
19
19
// xlsx := excelize.CreateFile()
20
20
// err := xlsx.AddPicture("Sheet1", "A2", "H9", "./image.jpg")
@@ -63,8 +63,9 @@ func (f *File) AddPicture(sheet string, xAxis string, yAxis string, picture stri
63
63
return err
64
64
}
65
65
66
- // addSheetRelationships provides function to add xl/worksheets/_rels/sheet%d.xml.rels by given
67
- // sheet name, relationship type and target.
66
+ // addSheetRelationships provides function to add
67
+ // xl/worksheets/_rels/sheet%d.xml.rels by given sheet name, relationship type
68
+ // and target.
68
69
func (f * File ) addSheetRelationships (sheet string , relType string , target string ) int {
69
70
var rels = "xl/worksheets/_rels/" + strings .ToLower (sheet ) + ".xml.rels"
70
71
var sheetRels xlsxWorkbookRels
@@ -93,8 +94,8 @@ func (f *File) addSheetRelationships(sheet string, relType string, target string
93
94
return rID
94
95
}
95
96
96
- // addSheetDrawing provides function to add drawing element to xl/worksheets/sheet%d.xml by
97
- // given sheet name and relationship index.
97
+ // addSheetDrawing provides function to add drawing element to
98
+ // xl/worksheets/sheet%d.xml by given sheet name and relationship index.
98
99
func (f * File ) addSheetDrawing (sheet string , rID int ) {
99
100
var xlsx xlsxWorksheet
100
101
name := "xl/worksheets/" + strings .ToLower (sheet ) + ".xml"
@@ -109,7 +110,8 @@ func (f *File) addSheetDrawing(sheet string, rID int) {
109
110
f .saveFileList (name , string (output ))
110
111
}
111
112
112
- // countDrawings provides function to get drawing files count storage in the folder xl/drawings.
113
+ // countDrawings provides function to get drawing files count storage in the
114
+ // folder xl/drawings.
113
115
func (f * File ) countDrawings () int {
114
116
count := 0
115
117
for k := range f .XLSX {
@@ -120,10 +122,10 @@ func (f *File) countDrawings() int {
120
122
return count
121
123
}
122
124
123
- // addDrawing provides function to add picture by given drawingXML, xAxis, yAxis, file name
124
- // and relationship index. In order to solve the problem that the label structure is changed
125
- // after serialization and deserialization, two different structures: decodeWsDr and encodeWsDr
126
- // are defined.
125
+ // addDrawing provides function to add picture by given drawingXML, xAxis,
126
+ // yAxis, file name and relationship index. In order to solve the problem that
127
+ // the label structure is changed after serialization and deserialization, two
128
+ // different structures: decodeWsDr and encodeWsDr are defined.
127
129
func (f * File ) addDrawing (drawingXML string , xAxis string , yAxis string , file string , rID int ) {
128
130
xAxis = strings .ToUpper (xAxis )
129
131
fromCol := string (strings .Map (letterOnlyMapF , xAxis ))
@@ -186,8 +188,9 @@ func (f *File) addDrawing(drawingXML string, xAxis string, yAxis string, file st
186
188
f .saveFileList (drawingXML , result )
187
189
}
188
190
189
- // addDrawingRelationships provides function to add image part relationships in the file
190
- // xl/drawings/_rels/drawing%d.xml.rels by given drawing index, relationship type and target.
191
+ // addDrawingRelationships provides function to add image part relationships in
192
+ // the file xl/drawings/_rels/drawing%d.xml.rels by given drawing index,
193
+ // relationship type and target.
191
194
func (f * File ) addDrawingRelationships (index int , relType string , target string ) int {
192
195
var rels = "xl/drawings/_rels/drawing" + strconv .Itoa (index ) + ".xml.rels"
193
196
var drawingRels xlsxWorkbookRels
@@ -216,7 +219,8 @@ func (f *File) addDrawingRelationships(index int, relType string, target string)
216
219
return rID
217
220
}
218
221
219
- // countMedia provides function to get media files count storage in the folder xl/media/image.
222
+ // countMedia provides function to get media files count storage in the folder
223
+ // xl/media/image.
220
224
func (f * File ) countMedia () int {
221
225
count := 0
222
226
for k := range f .XLSX {
@@ -227,17 +231,18 @@ func (f *File) countMedia() int {
227
231
return count
228
232
}
229
233
230
- // addMedia provides function to add picture into folder xl/media/image by given file
231
- // name and extension name.
234
+ // addMedia provides function to add picture into folder xl/media/image by given
235
+ // file name and extension name.
232
236
func (f * File ) addMedia (file string , ext string ) {
233
237
count := f .countMedia ()
234
238
dat , _ := ioutil .ReadFile (file )
235
239
media := "xl/media/image" + strconv .Itoa (count + 1 ) + ext
236
240
f .XLSX [media ] = string (dat )
237
241
}
238
242
239
- // addDrawingContentTypePart provides function to add image part relationships in
240
- // http://purl.oclc.org/ooxml/officeDocument/relationships/image and appropriate content type.
243
+ // addDrawingContentTypePart provides function to add image part relationships
244
+ // in http://purl.oclc.org/ooxml/officeDocument/relationships/image and
245
+ // appropriate content type.
241
246
func (f * File ) addDrawingContentTypePart (index int ) {
242
247
var imageTypes = map [string ]bool {"jpeg" : false , "png" : false , "gif" : false , "tiff" : false }
243
248
var content xlsxTypes
@@ -271,8 +276,9 @@ func (f *File) addDrawingContentTypePart(index int) {
271
276
f .saveFileList (`[Content_Types].xml` , string (output ))
272
277
}
273
278
274
- // getSheetRelationshipsTargetByID provides function to get Target attribute value
275
- // in xl/worksheets/_rels/sheet%d.xml.rels by given sheet name and relationship index.
279
+ // getSheetRelationshipsTargetByID provides function to get Target attribute
280
+ // value in xl/worksheets/_rels/sheet%d.xml.rels by given sheet name and
281
+ // relationship index.
276
282
func (f * File ) getSheetRelationshipsTargetByID (sheet string , rID string ) string {
277
283
var rels = "xl/worksheets/_rels/" + strings .ToLower (sheet ) + ".xml.rels"
278
284
var sheetRels xlsxWorkbookRels
0 commit comments