resolve #360, fix axis parse issue when add / get pictures;
typo fixed and go test updated
This commit is contained in:
parent
beff7b4f3c
commit
40ea8eb014
|
@ -819,8 +819,8 @@ func TestGetPicture(t *testing.T) {
|
|||
}
|
||||
|
||||
file, raw := xlsx.GetPicture("Sheet1", "F21")
|
||||
if !assert.NotEmpty(t, file) || !assert.NotEmpty(t, raw) ||
|
||||
!assert.NoError(t, ioutil.WriteFile(file, raw, 0644)) {
|
||||
if !assert.NotEmpty(t, filepath.Join("test", file)) || !assert.NotEmpty(t, raw) ||
|
||||
!assert.NoError(t, ioutil.WriteFile(filepath.Join("test", file), raw, 0644)) {
|
||||
|
||||
t.FailNow()
|
||||
}
|
||||
|
@ -851,8 +851,8 @@ func TestGetPicture(t *testing.T) {
|
|||
}
|
||||
|
||||
file, raw = xlsx.GetPicture("Sheet1", "F21")
|
||||
if !assert.NotEmpty(t, file) || !assert.NotEmpty(t, raw) ||
|
||||
!assert.NoError(t, ioutil.WriteFile(file, raw, 0644)) {
|
||||
if !assert.NotEmpty(t, filepath.Join("test", file)) || !assert.NotEmpty(t, raw) ||
|
||||
!assert.NoError(t, ioutil.WriteFile(filepath.Join("test", file), raw, 0644)) {
|
||||
|
||||
t.FailNow()
|
||||
}
|
||||
|
|
|
@ -266,6 +266,8 @@ func (f *File) addDrawingPicture(sheet, drawingXML, cell, file string, width, he
|
|||
col, row := MustCellNameToCoordinates(cell)
|
||||
width = int(float64(width) * formatSet.XScale)
|
||||
height = int(float64(height) * formatSet.YScale)
|
||||
col--
|
||||
row--
|
||||
colStart, rowStart, _, _, colEnd, rowEnd, x2, y2 :=
|
||||
f.positionObjectPixels(sheet, col, row, formatSet.OffsetX, formatSet.OffsetY, width, height)
|
||||
content, cNvPrID := f.drawingParser(drawingXML)
|
||||
|
@ -469,7 +471,8 @@ func (f *File) getSheetRelationshipsTargetByID(sheet, rID string) string {
|
|||
//
|
||||
func (f *File) GetPicture(sheet, cell string) (string, []byte) {
|
||||
col, row := MustCellNameToCoordinates(cell)
|
||||
|
||||
col--
|
||||
row--
|
||||
xlsx := f.workSheetReader(sheet)
|
||||
if xlsx.Drawing == nil {
|
||||
return "", []byte{}
|
||||
|
|
3
sheet.go
3
sheet.go
|
@ -1032,7 +1032,8 @@ func (f *File) workSheetRelsWriter() {
|
|||
}
|
||||
}
|
||||
|
||||
// fillSheetData fill missing row and cell XML data to made it continous from first cell [1, 1] to last cell [col, row]
|
||||
// fillSheetData fill missing row and cell XML data to made it continuous from
|
||||
// first cell [1, 1] to last cell [col, row]
|
||||
func prepareSheetXML(xlsx *xlsxWorksheet, col int, row int) {
|
||||
rowCount := len(xlsx.SheetData.Row)
|
||||
if rowCount < row {
|
||||
|
|
Loading…
Reference in New Issue