-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fixed drawingResize dimensions calculation #2123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2
Are you sure you want to change the base?
Changes from all commits
ebd2423
860f88e
9691bfb
d8500dc
bb9e855
f430024
3eda89c
39f85ff
67fa421
cf2102b
7d6ecef
8886fea
1a8887c
2531329
813e767
ddf3970
0340d13
ec177c1
c5f7cc5
49d9d83
fa62cc4
bf62569
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1034,7 +1034,7 @@ func (from *xlsxFrom) adjustDrawings(dir adjustDirection, num, offset int, editA | |
|
||
// adjustDrawings updates the ending anchor of the two cell anchor pictures | ||
// and charts object when inserting or deleting rows or columns. | ||
func (to *xlsxTo) adjustDrawings(dir adjustDirection, num, offset int, editAs string, ok bool) error { | ||
func (to *xlsxTo) adjustDrawings(dir adjustDirection, num, offset int, ok bool) error { | ||
if dir == columns && to.Col+1 >= num && to.Col+offset >= 0 && ok { | ||
if to.Col+offset >= MaxColumns { | ||
return ErrColumnNumber | ||
|
@@ -1054,27 +1054,35 @@ func (to *xlsxTo) adjustDrawings(dir adjustDirection, num, offset int, editAs st | |
// inserting or deleting rows or columns. | ||
func (a *xdrCellAnchor) adjustDrawings(dir adjustDirection, num, offset int) error { | ||
editAs := a.EditAs | ||
if a.From == nil || a.To == nil || editAs == "absolute" { | ||
if (a.From == nil && (a.To == nil || a.Ext == nil)) || editAs == "absolute" { | ||
return nil | ||
} | ||
ok, err := a.From.adjustDrawings(dir, num, offset, editAs) | ||
if err != nil { | ||
return err | ||
} | ||
return a.To.adjustDrawings(dir, num, offset, editAs, ok || editAs == "") | ||
if a.To != nil { | ||
return a.To.adjustDrawings(dir, num, offset, ok || editAs == "") | ||
} else { | ||
return nil | ||
} | ||
} | ||
|
||
// adjustDrawings updates the existing two cell anchor pictures and charts | ||
// object when inserting or deleting rows or columns. | ||
func (a *xlsxCellAnchorPos) adjustDrawings(dir adjustDirection, num, offset int, editAs string) error { | ||
if a.From == nil || a.To == nil || editAs == "absolute" { | ||
if (a.From == nil && (a.To == nil || a.Ext == nil)) || editAs == "absolute" { | ||
return nil | ||
} | ||
ok, err := a.From.adjustDrawings(dir, num, offset, editAs) | ||
if err != nil { | ||
return err | ||
} | ||
return a.To.adjustDrawings(dir, num, offset, editAs, ok || editAs == "") | ||
if a.To != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do this 👍 |
||
return a.To.adjustDrawings(dir, num, offset, ok || editAs == "") | ||
} else { | ||
return nil | ||
} | ||
} | ||
|
||
// adjustDrawings updates the pictures and charts object when inserting or | ||
|
@@ -1128,6 +1136,11 @@ func (f *File) adjustDrawings(ws *xlsxWorksheet, sheet string, dir adjustDirecti | |
return err | ||
} | ||
} | ||
for _, anchor := range wsDr.OneCellAnchor { | ||
if err = anchorCb(anchor); err != nil { | ||
return err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to add unit test for coverage this line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is at least already an integration test for this, which causes a failure if it is missing, adjust_test.go l. 1209 and following would fail now without this, since the col / row insertions would not occur for oneCellAnchors - if this is sufficient for you. |
||
} | ||
} | ||
return nil | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
else
statement no longer required. This can be simplify with:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do this 👍