Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ebd2423
[BUGFIX]: Removed size correction based on offset
R3dByt3 Apr 28, 2025
860f88e
[BUGFIX]: Fixed aspect ratio calculation of drawing resize
R3dByt3 Apr 28, 2025
9691bfb
[BUGFIX]: Fixed row pt to px conversion
R3dByt3 Apr 28, 2025
d8500dc
[SUGGESTION]: Updated default col width calculation
R3dByt3 Apr 28, 2025
bb9e855
[MISC]: Removed unused import
R3dByt3 Apr 28, 2025
f430024
[BUGFIX]: Added x1 and y1 as return values of positionObjectPixels again
R3dByt3 Apr 28, 2025
3eda89c
[BUGFIX]: Picture anchor was not respecting calculated start offsets
R3dByt3 Apr 28, 2025
39f85ff
[BUGFIX]: Drawing anchor was not respecting calculated start offsets
R3dByt3 Apr 28, 2025
67fa421
[BUGFIX]: Shape anchor was not respecting calculated start offsets
R3dByt3 Apr 28, 2025
cf2102b
[BUGFIX]: Discarding calculated start offsets for vml
R3dByt3 Apr 28, 2025
7d6ecef
[MISC]: Adjust should respect oneCellAnchors
R3dByt3 Apr 30, 2025
8886fea
[MISC]: Adjust should respect oneCellAnchors
R3dByt3 Apr 30, 2025
1a8887c
[MISC]: Updated excel default values [BUGFIX]: Fixed drawing dimensions
R3dByt3 Apr 30, 2025
2531329
[MISC]: Updated tests
R3dByt3 Apr 30, 2025
813e767
[MISC]: Updated tests
R3dByt3 Apr 30, 2025
ddf3970
[MISC]: Fixed drawing dimensions
R3dByt3 Apr 30, 2025
0340d13
[BUGFIX]: Implemented oneCellAnchors as oneCellAnchors
R3dByt3 Apr 30, 2025
ec177c1
[MISC]: Updated tests
R3dByt3 Apr 30, 2025
c5f7cc5
[MISC]: Added missing no custom row height logic
R3dByt3 Apr 30, 2025
49d9d83
[MISC]: Updated tests
R3dByt3 Apr 30, 2025
fa62cc4
[MISC]: Updated api
R3dByt3 Apr 30, 2025
bf62569
Update vml.go
R3dByt3 Apr 30, 2025
b8074ec
[BUGFIX]: Do not adjust absolute x2, y2 on oneCellAnchors
R3dByt3 May 5, 2025
6c431f4
[MISC]: Added test for oneCell pictures
R3dByt3 May 5, 2025
5e7c60c
[MISC]: Refactorings
R3dByt3 May 5, 2025
2b18d10
[MISC]: Refactorings
R3dByt3 May 5, 2025
7178a11
Add unit test for adjust one cell anchor drawing objects
xuri May 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions col.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,16 +800,15 @@ func (f *File) RemoveCol(sheet, col string) error {
// pixel. If the width hasn't been set by the user we use the default value.
// If the column is hidden it has a value of zero.
func convertColWidthToPixels(width float64) float64 {
var padding float64 = 5
var pixels float64
var maxDigitWidth float64 = 7
var maxDigitWidth float64 = 8
if width == 0 {
return pixels
}
if width < 1 {
pixels = (width * 12) + 0.5
return math.Ceil(pixels)
return float64(int(pixels))
}
pixels = (width*maxDigitWidth + 0.5) + padding
return math.Ceil(pixels)
pixels = (width*maxDigitWidth + 0.5)
return float64(int(pixels))
}
18 changes: 10 additions & 8 deletions picture.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,18 +753,20 @@ func (f *File) drawingResize(sheet, cell string, width, height float64, opts *Gr
cellHeight += f.getRowHeight(sheet, row)
}
}
if float64(cellWidth) < width {
asp := float64(cellWidth) / width
width, height = float64(cellWidth), height*asp
}
if float64(cellHeight) < height {
asp := float64(cellHeight) / height
height, width = float64(cellHeight), width*asp
if float64(cellWidth) < width || float64(cellHeight) < height {
aspWidth := float64(cellWidth) / width
aspHeight := float64(cellHeight) / height
var asp float64
if aspWidth < aspHeight {
asp = aspWidth
} else {
asp = aspHeight
}
width, height = width*asp, height*asp
}
if opts.AutoFitIgnoreAspect {
width, height = float64(cellWidth), float64(cellHeight)
}
width, height = width-float64(opts.OffsetX), height-float64(opts.OffsetY)
w, h = int(width*opts.ScaleX), int(height*opts.ScaleY)
return
}
Expand Down
2 changes: 1 addition & 1 deletion rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,5 +947,5 @@ func convertRowHeightToPixels(height float64) float64 {
if height == 0 {
return 0
}
return math.Ceil(4.0 / 3.4 * height)
return height * 4.0 / 3.0
}