push eventxuri/excelize-doc
commit sha 30851fb4245ab7477cbd32ce19060a1f30c276d6
Add docs for stream writer.
push time in 15 hours
issue comment360EntSecGroup-Skylar/excelize
f.formattedValue runtime error: invalid memory address or nil pointer dereference
Hi @wubin1989, thanks for your issue. I have fixed it. Please try to upgrade the library with the master branch code.
comment created time in 2 days
push event360EntSecGroup-Skylar/excelize
commit sha 5d8365ca17240f5b144d437a7b47052f22c4f3c6
Fix #529, handle empty inline rich text
push time in 2 days
issue closed360EntSecGroup-Skylar/excelize
f.formattedValue runtime error: invalid memory address or nil pointer dereference
<!-- If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.
Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST -->
Description
<!-- Briefly describe the problem you are having in a few paragraphs. -->
Steps to reproduce the issue:
- xlsx, err = excelize.OpenReader(resp.Body)
- sheetName := xlsx.GetSheetName(xlsx.GetActiveSheetIndex())
- rows, err = xlsx.GetRows(sheetName)
Describe the results you received:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb2c055]
goroutine 82
[running]:
github.com/360EntSecGroup-Skylar/excelize/v2.(*xlsxC).getValueFrom(0xc0103d1348, 0xc0000ffb00, 0xc0002b80a0, 0x1, 0x0, 0x0, 0xc0103d1310)
/data/wubin/gopath/pkg/mod/github.com/360!ent!sec!group-!skylar/excelize/v2@v2.0.2/rows.go:214 +0xe5
github.com/360EntSecGroup-Skylar/excelize/v2.(*Rows).Columns(0xc03612e000, 0x0, 0x40, 0xc00013c000, 0x0, 0x0)
/data/wubin/gopath/pkg/mod/github.com/360!ent!sec!group-!skylar/excelize/v2@v2.0.2/rows.go:80 +0x1c9
github.com/360EntSecGroup-Skylar/excelize/v2.(*File).GetRows(0xc0000ffb00, 0xc000392360, 0x6, 0x1, 0x1, 0x14, 0x0, 0x0)
/data/wubin/gopath/pkg/mod/github.com/360!ent!sec!group-!skylar/excelize/v2@v2.0.2/rows.go:41 +0xe4
Describe the results you expected:
no panic and get rows
Output of go version
:
go version go1.12.6 linux/amd64
Excelize version or commit ID:
v2.0.2
Environment details (OS, Microsoft Excel™ version, physical, etc.):
closed time in 2 days
wubin1989issue closed360EntSecGroup-Skylar/excelize
Write to file as stream row by row?
Hi, would it be possible to have something like stream-writing to a file in case of lots of rows? Like hitting the excel sheet row limit?
I'm not so familiar with GoLang's IO, but maybe there is no problem to achieve this?
For example I have millions of rows to put in excel sheets, and it is obviously memory heavy task. The idea is to read slice of rows from data source, like 100,000 at the time, then write them to the excel file in a loop until all rows was written. In such case there would be produced either excel file with few sheets or few excel files.
The primary idea is to handle memory consumption to reasonable amounts of RAM, like few gigabytes not tens..
What's Your opinion?
closed time in 2 days
Ryoukuissue comment360EntSecGroup-Skylar/excelize
Write to file as stream row by row?
Hi all, @Ryouku, @beezir, @mewben, @pjmuller, @kharism, @cemremengu, @duffiye Sorry for my late reply. I have added a stream writer for generating a new worksheet with huge amounts of data.
comment created time in 2 days
pull request comment360EntSecGroup-Skylar/excelize
Hi @chowey, thanks for your PR. This PR contains a lot of code and I need some time to review.
comment created time in 2 days
issue closed360EntSecGroup-Skylar/excelize
cannot download v2.0.2 by go get
<!-- If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.
Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST -->
Description
<!-- Briefly describe the problem you are having in a few paragraphs. -->
Steps to reproduce the issue:
- try to download v2.0.0 by using command
go get -u github.com/360EntSecGroup-Skylar/excelize/v2
Describe the results you received:
go: finding github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.2
go: downloading github.com/360EntSecGroup-Skylar/excelize v1.4.1
go: downloading github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.2
verifying github.com/360EntSecGroup-Skylar/excelize@v1.4.1: github.com/360EntSecGroup-Skylar/excelize@v1.4.1: reading https://goproxy.io/sumdb/sum.golang.org/lookup/github.com/360!ent!sec!group-!skylar/excelize@v1.4.1: 410 Gone
Describe the results you expected:
I want to use this package in my project, but when I was trying to install this package into my project, golang shows me some verifying information ends with 410 Gone
.Did I do some thing wrong?
Output of go version
:
go 1.13
(paste your output here)
Excelize version or commit ID:
(paste here)
Environment details (OS, Microsoft Excel™ version, physical, etc.):
closed time in 2 days
jasonYogeissue comment360EntSecGroup-Skylar/excelize
生成 100000行 300列的excel文件时,内存占用的厉害,能达到10G+
Hi @zhaoche27, thanks for your issue. I have added a stream writer for generating a new worksheet with huge amounts of data.
comment created time in 3 days
push event360EntSecGroup-Skylar/excelize
commit sha 08d1a86c3a1bffdf431dba6a3d5a3b369ef740a7
Fix #523, add stream writer for generate new worksheet with huge amounts of data
push time in 3 days
issue closed360EntSecGroup-Skylar/excelize
生成 100000行 300列的excel文件时,内存占用的厉害,能达到10G+
本人fork了,修改了一下,commit:https://github.com/zhaoche27/excelize/commit/bc59aa0e1fbcf8e99967c58ea5431dd096b97526
closed time in 3 days
zhaoche27Pull request review comment360EntSecGroup-Skylar/excelize
func (f *File) GetMergeCells(sheet string) ([]MergeCell, error) { return mergeCells, err } +// RemoveMergeCell removes a MergeCell.+func (f *File) RemoveMergeCell(sheet string, m MergeCell) error {+ xlsx, err := f.workSheetReader(sheet)+ if err != nil {+ return err+ }+ if xlsx.MergeCells != nil {+ for i := range xlsx.MergeCells.Cells {+ ref := xlsx.MergeCells.Cells[i].Ref+ if ref == m[0] {+ f.deleteMergeCell(xlsx, i)+ break+ }+ }+ }+ return nil+}+
Please add the tests to cover your changes.
comment created time in 3 days
Pull request review comment360EntSecGroup-Skylar/excelize
func (f *File) GetMergeCells(sheet string) ([]MergeCell, error) { return mergeCells, err } +// RemoveMergeCell removes a MergeCell.+func (f *File) RemoveMergeCell(sheet string, m MergeCell) error {
I propose to use UnmergeCells
as the function name.
comment created time in 3 days
push eventxuri/excelize-doc
commit sha 851b2fb1fb57050e46ed0d96175aacc20919fd24
add docs for 3D cone stacked bar chart
push time in 5 days
push eventxuri/excelize-doc
commit sha b9de267b45022bc288ce26322d441381ae838c34
Update the example of the ThemeColor function applied the color with tint value
push time in 6 days
issue comment360EntSecGroup-Skylar/excelize
How to insure cell data correct(after set dataValidation)
Similar to issue #65, implementing a data validation would require a very large number of test cases would be several months of work involved. That's an interesting job and I will consider adding support for this feature later. I'll certainly accept that patch if somebody did that.
comment created time in 6 days
issue comment360EntSecGroup-Skylar/excelize
How to insure cell data correct(after set dataValidation)
Hi @GZLHZ, this library currently only supports setting data validation for the generated file. Data validation will be executed on runtime when you use Excel software to open the generated file.
comment created time in 6 days
issue comment360EntSecGroup-Skylar/excelize
Hi @GZLHZ, please try to get cell background color like this:
package main
import (
"fmt"
"strings"
"github.com/360EntSecGroup-Skylar/excelize"
)
func main() {
f, err := excelize.OpenFile("Book1.xlsx")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(getCellBgColor(f, "Sheet1", "A1"))
}
func getCellBgColor(f *excelize.File, sheet, axix string) string {
styleID, err := f.GetCellStyle(sheet, axix)
if err != nil {
return err.Error()
}
fillID := f.Styles.CellXfs.Xf[styleID].FillID
fgColor := f.Styles.Fills.Fill[fillID].PatternFill.FgColor
if fgColor.Theme != nil {
children := f.Theme.ThemeElements.ClrScheme.Children
if *fgColor.Theme < 4 {
dklt := map[int]string{
0: children[1].SysClr.LastClr,
1: children[0].SysClr.LastClr,
2: children[3].SrgbClr.Val,
3: children[2].SrgbClr.Val,
}
return strings.TrimPrefix(excelize.ThemeColor(dklt[*fgColor.Theme], fgColor.Tint), "FF")
}
srgbClr := children[*fgColor.Theme].SrgbClr.Val
return strings.TrimPrefix(excelize.ThemeColor(srgbClr, fgColor.Tint), "FF")
}
return strings.TrimPrefix(fgColor.RGB, "FF")
}
comment created time in 6 days
push eventxuri/excelize-doc
commit sha 3d505b7b1711a662b69e4a56db79c73b8911c79e
add docs for 3D clustered bar chart
push time in 7 days
push eventxuri/excelize-doc
commit sha 5b06dd1b2aa2aec8eab1d44f327c40c289776a03
add docs for 3D cone clustered bar chart
push time in 9 days
push event360EntSecGroup-Skylar/excelize
commit sha 842b942c71df8a7bcc6e8f32232851679bd6a090
Compatible with up to 64 namespaces of Kingsoft WPS
push time in 10 days
push event360EntSecGroup-Skylar/excelize
commit sha 402ad2f62b04d44f1ab866b32b9e7314a713e5f0
Update XML namespace
push time in 13 days
issue closed360EntSecGroup-Skylar/excelize
SetPageLayout doesn't work for FitToWidth and FitToHeight
<!-- If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.
Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST -->
Description
I want to set width to page layout. I send FitToWidth as argument, but it doesn't actually work.
Code:
file.SetPageLayout(
sheet,
excelize.FitToWidth(1),
excelize.PageLayoutOrientation(excelize.OrientationLandscape),
)
Every value is set. Orientation is set to landscape at excel, but width is not set to 1.
Maybe it would help When I do it with this code
file.SetPageLayout(
sheet,
excelize.FitToWidth(1),
excelize.PageLayoutOrientation(excelize.OrientationLandscape),
)
(Removed other attributes) The XML is:
<style:page-layout-properties style:print-orientation="portrait" style:scale-to="100%"/>
When I change it in excel and save it. XML is:
<style:page-layout-properties style:print-orientation="portrait" loext:scale-to-X="1"/>
Steps to reproduce the issue:
- Create file.
- Create sheet
- Set page layout option
Describe the results you received: width is automatic
Describe the results you expected: 1 page
Output of go version
:
1.12.10
Excelize version or commit ID:
a00ba75f0f294ce04bfe8d25703d13cd27d6284f
Environment details (OS, Microsoft Excel™ version, physical, etc.): Windows 10 Microsoft Excel 2016
closed time in 13 days
Jk1484push eventxuri/excelize-doc
commit sha c91a16148044d1a8c20c461132fa276887bd3f36
Split markdown file for all charts document
push time in 14 days
issue comment360EntSecGroup-Skylar/excelize
Problems with xlsm file using ActiveX elements after saving
Hi @dennisfleischmann, I have fixed it. Please try to upgrade the library with the master branch code.
comment created time in 14 days
push event360EntSecGroup-Skylar/excelize
commit sha 8d6e431dcd8d96dc51f74308e49b5d4a5b2b9d2e
Resolve #521, fix missing elements when parsing
push time in 14 days
issue closed360EntSecGroup-Skylar/excelize
Problems with xlsm file using ActiveX elements after saving
Description We are using this library for copying data from source.xlsm file to destintation.xlsm file. The destintation.xlsm has some ActiveX Controls as well. After copying a cell value from source to destintation and saving it we opened it in Excel and it loses the ActiveX Control.
Instead it shows a shape with a macro connected/assigned to it.
A simple way to reproduce the same issue is the following
Steps to reproduce the issue:
- Create a xlsm file with a ActiveX Control CommandButton
- Douple click on it and add an event handler
- Use excelize library and change any cell value and save it
Example files Original Source file(before saving) https://www.dropbox.com/s/9glskdk2dwyl8xr/before_ws.xlsm?dl=0 After saving (A1 cell is set to hello) https://www.dropbox.com/s/zoor0m6cjl7q7p2/after_ws.xlsm?dl=0
Describe the results you received: ActiveX Controls changed to a shape and ActiveXControls are getting lost
Describe the results you expected: ActiveX controls still persist and are functional
Output of go version
:
go1.12.6
Excelize version or commit ID: da99334f Mon Aug 19 16:52:14 2019
Environment details (OS, Microsoft Excel™ version, physical, etc.):
Windows 7 and OS
closed time in 14 days
dennisfleischmannissue comment360EntSecGroup-Skylar/excelize
cannot download v2.0.2 by go get
Hi @jasonYoge, please delete go mod cache $GOPATH/pkg/mod/cache and try again. Ref #393, #403 and #488.
comment created time in 15 days
issue comment360EntSecGroup-Skylar/excelize
Problems with xlsm file using ActiveX elements after saving
Hi @dennisfleischmann, the link of the example source file is the same as the saved file.
comment created time in 15 days
push eventxuri/excelize-doc
commit sha da4b284f77869cf2e7cda1536b3f15fddbff5e93
Split markdown file for en charts document
push time in 16 days
push eventxuri/excelize-doc
commit sha 5edc683431da0dc82cfdc58d10426f8db67db90b
Split markdown file for zh-cn charts document
push time in 16 days
issue comment360EntSecGroup-Skylar/excelize
Saving excel file makes it corrupt
Hi @dennisfleischmann, please provide code and file attachment to reproduce this issue if you can.
comment created time in 16 days
issue comment360EntSecGroup-Skylar/excelize
Hi @codedart2018, I have refactored the Rows
function, please try to upgrade the library with the master branch code.
comment created time in 16 days
issue comment360EntSecGroup-Skylar/excelize
Hi @codedart2018, I have made the function GetRow
and Rows
read data as streaming. You can get all the data in the worksheet at once through GetRows
, or read the data row by row using Rows
and Next
like this:
// read top 10 rows
rows, err := f.Rows("Sheet1")
if err != nil {
fmt.Println(err)
return
}
for rows.Next() {
count++
if count > 10 {
break
}
row, _ := rows.Columns()
for _, colCell := range row {
fmt.Print(colCell, "\t")
}
fmt.Println()
}
comment created time in 19 days
issue comment360EntSecGroup-Skylar/excelize
Is there anyway to read top N rows ?
Hi @shawnye, thanks for your issue, sorry for my late reply. I have made the function GetRow
and Rows
read data as streaming. You can get all the data in the worksheet at once through GetRows
, or read the data row by row using Rows
and Next
like this:
// read top 10 rows
rows, err := f.Rows("Sheet1")
if err != nil {
fmt.Println(err)
return
}
for rows.Next() {
count++
if count > 10 {
break
}
row, _ := rows.Columns()
for _, colCell := range row {
fmt.Print(colCell, "\t")
}
fmt.Println()
}
comment created time in 19 days
push event360EntSecGroup-Skylar/excelize
commit sha 7965e1231b736f8507f93f6383b76332eb15ff5f
Resolve #146, make the GetRow function read data as streaming. Ref: #382, #515
push time in 19 days
issue closed360EntSecGroup-Skylar/excelize
Is there anyway to read top N rows ?
Suppose there is big files containing 500,000 rows , I just want to read top 1000 rows, could you provide the method like ReadTop(sheetName string, rows int) [][]string
, maybe you could use xml stream reading to save a lot of memory than I do with GetRows()
.
Thanks.
closed time in 19 days
shawnyeissue comment360EntSecGroup-Skylar/excelize
AddChart only drew the first line in a multine chart
Hi @araoko, thanks for your feedback. Could you provide the code and file attachment to reproduce the issue?
comment created time in 21 days
issue comment360EntSecGroup-Skylar/excelize
SetPageLayout doesn't work for FitToWidth and FitToHeight
Hi @Jk1484, thanks for your issue. Please enable FitToPage
by SetSheetPrOptions
when you specify FitToWidth
and FitToHeight
of the worksheet, for example:
if err := f.SetSheetPrOptions(
sheet,
excelize.FitToPage(true),
); err != nil {
panic(err)
}
comment created time in 21 days
issue closed360EntSecGroup-Skylar/excelize
1c,2G sever reads 200000 excel,memory is full.
f.GetRows("Sheet1")
error:
fatal error: runtime: out of memory
i want to read the data in batches and return an array to me.
i really hope
row, err:=f.GetRows("Sheet1", 1000)
thank you all
closed time in 21 days
codedart2018issue comment360EntSecGroup-Skylar/excelize
Hi @codedart2018, thanks for your issue. I close this and merge it into issue #146 is still discussing this feature.
comment created time in 21 days
issue comment360EntSecGroup-Skylar/excelize
Set zoom scale for inserted picture
Hi @roamboy, thanks for your issue. You can set the zoom scale of the image by AddPicture
like this:
err := f.AddPicture("Sheet1", "D2", "./image2.jpg", `{"x_scale": 0.5, "y_scale": 0.5}`)
if err != nil {
fmt.Println(err)
}
comment created time in 21 days
issue comment360EntSecGroup-Skylar/excelize
Hi @JiBadBoy, thanks for your feedback. Could you provide the code and file attachment to reproduce the issue?
comment created time in 21 days
issue closed360EntSecGroup-Skylar/excelize
Hello all, I am using excelize for a long time, and I have noticed that I am getting blank sheet (blank file). It is happening on all OS platforms. Issue happens randomly, if i start same export of data once it can be filled, once I get empty sheet. It can happen that I have blank once in 1000 or so. After hard testing I have spotted that part which is causing this issue is in f.DeleteSheet("Sheet1") I am calling this function before I use SaveAs. Before that I have tracked data, and xlsx file should be populated, but excelize saves empty file.
closed time in 23 days
OFAHpush eventxuri/excelize-doc
commit sha 16c3911eea531564a80a39b413019fbb2625d12e
Update logo for vendors
push time in a month
issue comment360EntSecGroup-Skylar/excelize
Do you means get style detail of the cell? Maybe reference issue #314.
comment created time in a month
pull request comment360EntSecGroup-Skylar/excelize
Reduce allocations when writing
LGTM, thanks @mlh758.
comment created time in a month
push event360EntSecGroup-Skylar/excelize
commit sha bf9a8355494eac18812f3caf6d469962824f627f
Reduce allocations when writing Fix #494 If a row is full, don't bother allocating a new one, just return it. Use the last populated row as a hint for the size of new rows. Simplify checkSheet to remove row map
commit sha c8c8397751e994dca05467e7615f6ee77704775b
Fix #494 Merge pull request #514 from mlh758/fix-494-write-allocations Reduce allocations when writing
push time in a month
PR merged 360EntSecGroup-Skylar/excelize
PR Details
Fix #494
If a row is full, don't bother allocating a new one, just return it.
Use the last populated row as a hint for the size of new rows.
Simplify checkSheet to remove row map (tiny performance improvement, mostly just easier to follow now)
Related Issue
#494
Motivation and Context
Reduce memory consumed while creating a document
How Has This Been Tested
Added a new benchmark, ensured tests continue to pass
Master BenchmarkWrite-8 2 601920270 ns/op 207277296 B/op 1893770 allocs/op
This fix BenchmarkWrite-8 2 567284257 ns/op 127115028 B/op 1833744 allocs/op
Rows: Master BenchmarkRows-8 10000 362571 ns/op 2010561 B/op 30 allocs/op This fix BenchmarkRows-8 10000 349607 ns/op 2010560 B/op 30 allocs/op
Performance wise, the change I made to rows barely makes a difference, most of that was likely stack allocated anyway. This is just simpler.
Types of changes
<!--- What types of changes does your code introduce? Put an x
in all the boxes that apply: -->
- [ ] Docs change / refactoring / dependency upgrade
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
<!--- Go over all the following points, and put an x
in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
pr closed time in a month
issue closed360EntSecGroup-Skylar/excelize
<!-- If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.
Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST -->
Description Too much memory <!-- Briefly describe the problem you are having in a few paragraphs. -->
Steps to reproduce the issue: 1.Create a new file。 2.Write a million pieces of data。 3.Analysis memory。
Describe the results you received:
Will occupy at least 2G of memory
Describe the results you expected:
Minimum memory footprint
Output of go version
:
1.12.5
(paste your output here)
Excelize version or commit ID:
(paste here)
Environment details (OS, Microsoft Excel™ version, physical, etc.):
closed time in a month
PengWuLinpush eventxuri/excelize-doc
commit sha 94835d1c941b239cb9c472b6adda3263c688ad5e
Add docs for grid lines option of the AddChart function.
push time in a month
issue closed360EntSecGroup-Skylar/excelize
Is it possible to convert xlsx file to csv, using excelize? Can't find manual about this feature
closed time in a month
yclients-smart-box-readerissue closed360EntSecGroup-Skylar/excelize
Using $ before first column range in formulas writes column in lowercase in xml files
When i use formulas in a document, and i open it after with Excell or libreoffice, i need to do a full replace of sum to SUM for the formula to work.
Same for vlookup to replace with VLOOKUP.
In xml file, the SUM is in uppercase but when opened in libreoffice or microsof Excell it appear in lowercase.
I haven't found any way to prevent this and it might be long for huge documents to replace formulas in the whole document.
closed time in a month
gquinetissue closed360EntSecGroup-Skylar/excelize
Use same code to generate a xlsx, and the data of xlsx in bytes is not same.
It is not friendly to git. Everty time i run the code, i got a modify in git... Is there any way to solve it?
for example:
func TestWrite(t *testing.T){
xlsx := excelize.NewFile()
xlsx.SetCellValue("Sheet1", "B2", 100)
err := xlsx.SaveAs("./Write.xlsx")
if err != nil {
fmt.Println(err)
}
}
/*first time data like this
504b 0304 1400 0800 0800 0000 0000 0000
0000 0000 0000 0000 0000 1300 0000 786c
2f74 6865 6d65 2f74 6865 6d65 312e 786d
6cec 99cf 6fdb 3614 c7ef fb2b 08de 57c9
3f64 c741 9522 b1e3 766b d216 8ddb a1c7
6789 9658 53a4 40d2 497c 1bda d32e 0306
/*
/* second time data...
504b 0304 1400 0800 0800 0000 0000 0000
0000 0000 0000 0000 0000 0f00 0000 786c
2f77 6f72 6b62 6f6f 6b2e 786d 6c8c 92cf
6edb 300c c6ef 7b0a 81f7 c652 9006 4160
b9c0 b00d cb65 08b0 ae3d 2b12 1d13 d11f
4392 9be4 ed07 394d e3a2 979c 2851 f68f
....
*/
closed time in a month
xtutuissue closed360EntSecGroup-Skylar/excelize
VLOOKUP can not correct search the value
package main
import (
"log"
"time"
"github.com/xuri/excelize"
)
var check = func(err error) {
if err != nil {
panic(err)
}
}
func main() {
xlsx, err := excelize.OpenFile("input.xlsx")
check(err)
v, err := time.Parse("2006/01/02", "2017/07/26")
check(err)
xlsx.SetCellValue("Sheet1", "A1", v)
err = xlsx.SaveAs("./output.xlsx")
if err != nil {
log.Fatalln(err)
}
// Bug: open output.xlsx in excel and the "D1" should be 7
}
closed time in a month
dlintwissue closed360EntSecGroup-Skylar/excelize
Hi Luxurioust,
first of all, AWESOME library. Got it up and running in no time thanks through the great documentation.
You know what would make excelize even better? Having a way to enable auto filter. I've searched around and it should be possible. See http://xlsxwriter.readthedocs.io/working_with_autofilters.html
I dug around a bit in the python source code and most of the logic is defined here https://github.com/jmcnamara/XlsxWriter/blob/master/xlsxwriter/worksheet.py#L1472 (however I don't understand a whole lot of it... ) Hopefully you do
I'm not an advanced enough go developer to create a good PR, but would be very grateful if you could add this feature to excelize.
closed time in a month
pjmullerissue comment360EntSecGroup-Skylar/excelize
Hi @araoko, thanks for your issue. I have added minor_grid_lines
option, you can create a chart with grid lines like this:
"x_axis":{"major_grid_lines":true,"minor_grid_lines":true},"y_axis":{"major_grid_lines":true,"minor_grid_lines":true}
comment created time in a month
push event360EntSecGroup-Skylar/excelize
commit sha 6abf8bf9723512086f009ca574bde1d6682fc83d
Resolve #501, support set minor grid lines for the chart
push time in a month
issue closed360EntSecGroup-Skylar/excelize
The axis options do not include gridlines. it will be nice to be able to specify gridlines
closed time in a month
araokoissue comment360EntSecGroup-Skylar/excelize
Hi @joneskoo, thanks for your issue. I have added a new function DeleteDefinedName
, you can delete the defined name and re-set that.
comment created time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha 5e418ebd665f38d1211b27d7157ec7e5868451bc
Resolve #507, add the new function `DeleteDefinedName`
push time in 2 months
issue closed360EntSecGroup-Skylar/excelize
Description
It is possible to set defined name (i.e. named range):
_ = f.SetDefinedName(&excelize.DefinedName{
Name: "data",
RefersTo: sheetName + "!$A$2:$P$50"),
})
However, there does not seem to exist a way to overwrite this. Calling SetDefinedName again returns an error: the same name already exists on scope
https://github.com/360EntSecGroup-Skylar/excelize/blob/26aa58de055b0430b9332a768ce00d69fcf8994e/sheet.go#L1268-L1270
I can't find a call to delete a DefinedName and if I look it up with Get and modify it, changes are not saved.
Please enable updating the range of an existing DefinedName.
Excelize version or commit ID:
github.com/360EntSecGroup-Skylar/excelize/v2 v2.0.2
closed time in 2 months
joneskoopush eventxuri/excelize-doc
commit sha fe617d40c732750fd38fd9f600c1cd57fe801bac
Update docs for the function `AddChart`
push time in 2 months
issue comment360EntSecGroup-Skylar/excelize
Pivot Table: allow empty columns
Hi @dongnengyu, thanks for your issue. I have added empty columns support for creating a pivot table. Please try to upgrade the library with the master branch code.
comment created time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha 87390cdd99b3afbe07daeef9abe96f57d03cb352
Resolve #511, allow empty columns in the pivot table
push time in 2 months
issue closed360EntSecGroup-Skylar/excelize
Pivot Table: allow empty columns
透视表生成方式是否可以参考下python的numpy库,我在项目中不需要列标签,但是这个工具库不允许不设置列标签,一旦列标签设置为空就会报错。
下面是numpy的透视表生成方式
closed time in 2 months
dongnengyupush event360EntSecGroup-Skylar/excelize
commit sha 9fe267ffcfa06545223160cdb8c35cd91163730e
Pre-allocate some memory when reading files (#510)
push time in 2 months
PR merged 360EntSecGroup-Skylar/excelize
PR Details
This makes it so we pre-allocate some of the memory we need when reading files.
Description
We know how many files will be stored, and how big they will be so we can use those to allocate buffers instead of growing them with append.
I also changed the Rows benchmark to not include file opening as part of it, and gave opening a file its own benchmark. No massive improvements here, just a small reduction in memory pressure when reading.
Old BenchmarkOpenFile-8 1000 1585980 ns/op 631000 B/op 4533 allocs/op New BenchmarkOpenFile-8 1000 1521844 ns/op 547654 B/op 4498 allocs/op
Related Issue
I could open an issue for it, but this wasn't causing any problems worth raising an issue for.
Motivation and Context
Just reducing memory pressure a little when reading a lot of files.
How Has This Been Tested
Unit tests still pass, still able to read a test file.
Types of changes
<!--- What types of changes does your code introduce? Put an x
in all the boxes that apply: -->
- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
<!--- Go over all the following points, and put an x
in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
pr closed time in 2 months
issue comment360EntSecGroup-Skylar/excelize
Hi @wrycode, I have fixed it. Please try to upgrade the library with the master branch code.
comment created time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha e7581ebf3e14f096b6e2d56ed34d381b4af6d310
Fix corrupted Excel file issue #413
push time in 2 months
issue comment360EntSecGroup-Skylar/excelize
Hi @wrycode, thanks for your issue. I will fix it recently. FYI: If you just want to change the default workbook name, you can use SetSheetName
without deleting it.
comment created time in 2 months
push eventxuri/aurora
commit sha a30aa2775640e9c33339d4ff38d83f32842a021b
Use strings builder instead of buffer
push time in 2 months
issue comment360EntSecGroup-Skylar/excelize
Complex chart style: line width
Hi @byteman, I have added support for the set line width of the line chart. Set the width by the specified line
parameter in each series:
f.AddChart("Sheet2", "X16", `{
"type": "line",
"series": [
{
"name": "Sheet1!$A$37",
"categories": "Sheet1!$B$29:$D$29",
"values": "Sheet1!$B$37:$D$37",
"line":
{
"width": 0.25
}
}]
}`)
comment created time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha 7716968abc1d330492e311504af8951c34fb7520
Fix #505, support set line width of the line chart
push time in 2 months
issue closed360EntSecGroup-Skylar/excelize
Complex chart style: line width
我再在用go生成一个2D折线图的时候,只有很简单的图表样式可以操作,有什么办法可以生成比较复杂的图表样式吗?或者可以先在excel中设置好样式,然后用go读取出来样式,然后生成在我自己的程序中吗??
closed time in 2 months
bytemanpush eventxuri/excelize-doc
commit sha 30c778e55e0bee95492f4de55e86459c0fc2d0ea
Add docs for Set/Get page margins
push time in 2 months
issue comment360EntSecGroup-Skylar/excelize
Hi @hnistlzy, AddPicture supports image scaling settings:
err := f.AddPicture("Sheet1", "D2", "./excel.jpg", `{"x_scale": 0.5, "y_scale": 0.5}`)
if err != nil {
fmt.Println(err)
}
comment created time in 2 months
push eventxuri/efp
commit sha b7dc4fe9aa91d98f40a481ed3d1fd36efbaf209d
Update GitHub Action settings.
push time in 2 months
issue comment360EntSecGroup-Skylar/excelize
What complex styles do you need, please list them if possible, and I will consider adding support for them. A method for generating a new file based on a template: Create a chart template using Excel Application, open the template file with this lib, and modify the data area referenced by the chart to save it as a new file.
comment created time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
type xlsxWorksheet struct { ExtLst *xlsxExtLst `xml:"extLst"` } +// MarshalXML implements xml.Marshaler
A lot of code in this PR, I need some time to review.
comment created time in 2 months
issue closed360EntSecGroup-Skylar/excelize
Infinite loop row iterator bug/breaking change
There's a bug/breaking change in v2.0.2 that causes rows.Next
to loop forever. A minimal reproduction case is available here: https://github.com/fharding1/excelize-repro
After bisecting, the commit that introduced this bug is:
[ac91ca0ded4111ed9f22578d4a0570a9084c97b0] Only parse xml once when reading
While before it didn't matter whether you called Columns() on each row, now you must. I think this should be documented behavior at the very least, as it's a potentially harmful breaking change.
closed time in 2 months
fharding1push event360EntSecGroup-Skylar/excelize
commit sha 866fda230028a3a9e6ff1c5234e432ad850d3c6b
fix #503 rows next issue
push time in 2 months
PR merged 360EntSecGroup-Skylar/excelize
PR Details
<!--- Provide a general summary of your changes in the Title above --> Fix bug
Description
rows.Next should increase the curRow
variable
while rows.Columns
shouldn't do it
<!--- Describe your changes in detail -->
Related Issue
https://github.com/360EntSecGroup-Skylar/excelize/issues/502 <!--- This project only accepts pull requests related to open issues --> <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Please link to the issue here: -->
Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
How Has This Been Tested
- Add a unit test. Using require to cancel the test immediately instead of
if !assert.NoError(t, rows.Error()) {
t.FailNow()
}
<!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. -->
Types of changes
<!--- What types of changes does your code introduce? Put an x
in all the boxes that apply: -->
- [ ] Docs change / refactoring / dependency upgrade
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
<!--- Go over all the following points, and put an x
in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
pr closed time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
func (rows *Rows) Error() error { // Columns return the current row's column values func (rows *Rows) Columns() ([]string, error) {- curRow := rows.rows[rows.curRow]- rows.curRow+++ fmt.Println(rows.curRow)
remove debug code
comment created time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
type Rows struct { // Next will return true if find the next row element. func (rows *Rows) Next() bool {+ rows.curRow++ return rows.curRow < len(rows.rows)
should be
return rows.curRow <= len(rows.rows)
comment created time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
func (rows *Rows) Error() error { // Columns return the current row's column values func (rows *Rows) Columns() ([]string, error) { curRow := rows.rows[rows.curRow]
should be:
curRow := rows.rows[rows.curRow-1]
comment created time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
func TestRows(t *testing.T) { } } +// test bug https://github.com/360EntSecGroup-Skylar/excelize/issues/502+func TestRowsIterator(t *testing.T) {+ const (+ sheet2 = "Sheet2"+ expectedNumRow = 11+ )+ xlsx, err := OpenFile(filepath.Join("test", "Book1.xlsx"))+ require.NoError(t, err)++ rows, err := xlsx.Rows(sheet2)+ require.NoError(t, err)+ rowCount := 1
should be:
var rowCount int
comment created time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
func TestRows(t *testing.T) { } } +// test bug https://github.com/360EntSecGroup-Skylar/excelize/issues/502+func TestRowsIterator(t *testing.T) {+ const (+ sheet2 = "Sheet2"+ expectedNumRow = 11+ )+ xlsx, err := OpenFile(filepath.Join("test", "Book1.xlsx"))+ require.NoError(t, err)++ rows, err := xlsx.Rows(sheet2)+ require.NoError(t, err)+ rowCount := 1
should be
var rowCount int
comment created time in 2 months
issue comment360EntSecGroup-Skylar/excelize
Infinite loop row iterator bug/breaking change
Hi @fharding1, thanks for your issue. Confirm that this problem was introduced by PR #456, I will start repairing as soon as possible.
comment created time in 2 months
push eventxuri/efp
commit sha f589e4ae6276d69520944a35c3b6b7906316069d
Use GitHub Actions
push time in 2 months
push eventxuri/efp
commit sha d9c8a1e6e926433bf32cdada692e1c5ee0cd5127
GitHub Actions
push time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha 2e791fa433def282ee2e7a5049a46fc4a76796cf
Optimize code of Getting/Setting Page Margins
push time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha 3e0e0bc73fce6175964f2a5db7182d930371d425
Typo fixed
push time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha 26aa58de055b0430b9332a768ce00d69fcf8994e
Optimize code of Getting/Setting Page Margins
push time in 2 months
push eventxuri/efp
commit sha b442cc7a8c8be334bad88d5939edb7d510c2b087
Update go.yml
push time in 2 months
push event360EntSecGroup-Skylar/excelize
commit sha 2d21b5b50f30ae9868b2f8b1f7299ceefcf87fd2
Added accessors for Getting/Setting Page Margins (#497) * Added accessors for Getting/Setting Page Margins * Added test cases
push time in 2 months
PR merged 360EntSecGroup-Skylar/excelize
PR Details
Added accessors for getting setting page margins
Description
SetPageMargins provides a function to set worksheet page lmargins.
Available options: PageMarginBotom(float64) PageMarginFooter(float64) PageMarginHeader(float64) PageMarginLeft(float64) PageMarginRightfloat64) PageMarginTop(float64)
GetPageMargins provides a function to get worksheet page margins.
Available options: PageMarginBotom(float64) PageMarginFooter(float64) PageMarginHeader(float64) PageMarginLeft(float64) PageMarginRightfloat64) PageMarginTop(float64)
Related Issue
#407 Setting Page Margins
Motivation and Context
Added functionality
How Has This Been Tested
Existing tests
Types of changes
- [x] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.
pr closed time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
Added accessors for Getting/Setting Page Margins
func (f *File) searchSheet(name, value string, regSearch bool) ([]string, error) // // - No footer on the first page //+
Remove blank lines, please read the CONTRIBUTING.
comment created time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
Added accessors for Getting/Setting Page Margins
func makeContiguousColumns(xlsx *xlsxWorksheet, fromRow, toRow, colCount int) { fillColumns(rowData, colCount, fromRow) } }++++type (+ PageMarginBottom float64+ PageMarginFooter float64+ PageMarginHeader float64+ PageMarginLeft float64+ PageMarginRight float64+ PageMarginTop float64+)++func (p PageMarginBottom) setPageMargins(ps *xlsxPageMargins) {+ ps.Bottom = float64(p)+}+func (p PageMarginFooter) setPageMargins(ps *xlsxPageMargins) {+ ps.Footer = float64(p)+}+func (p PageMarginHeader) setPageMargins(ps *xlsxPageMargins) {+ ps.Header = float64(p)+}+func (p PageMarginLeft) setPageMargins(ps *xlsxPageMargins) {+ ps.Left = float64(p)+}+func (p PageMarginRight) setPageMargins(ps *xlsxPageMargins) {+ ps.Right = float64(p)+}+func (p PageMarginTop) setPageMargins(ps *xlsxPageMargins) {+ ps.Top = float64(p)+}++// PageMarginsOptions is an option of a page margin of a worksheet. See+// SetPageMargins().+type PageMarginsOptions interface {+ setPageMargins(layout *xlsxPageMargins)+}++// PageMarginsOptionsPtr is a writable PageMarginsOptions. See GetPageMargins().+type PageMarginsOptionsPtr interface {+ PageMarginsOptions+ getPageMargins(layout *xlsxPageMargins)+}++// SetPageMargins provides a function to set worksheet page lmargins.+//+// Available options:+// PageMarginBotom(float64)+// PageMarginFooter(float64)+// PageMarginHeader(float64)+// PageMarginLeft(float64)+// PageMarginRightfloat64)+// PageMarginTop(float64)+func (f *File) SetPageMargins(sheet string, opts ...PageMarginsOptions) error {+ s, err := f.workSheetReader(sheet)+ if err != nil {+ return err+ }+ ps := s.PageMargins+ if ps == nil {+ ps = new(xlsxPageMargins)+ s.PageMargins = ps+ }++ for _, opt := range opts {+ opt.setPageMargins(ps)+ }+ return err+}++// GetPageMargins provides a function to get worksheet page margins.+//+// Available options:+// PageMarginBotom(float64)+// PageMarginFooter(float64)+// PageMarginHeader(float64)+// PageMarginLeft(float64)+// PageMarginRightfloat64)+// PageMarginTop(float64)+func (f *File) GetPageMargins(sheet string, opts ...PageMarginsOptionsPtr) error {
Please add the unit test for the function.
comment created time in 2 months
Pull request review comment360EntSecGroup-Skylar/excelize
Added accessors for Getting/Setting Page Margins
type FormatHeaderFooter struct { FirstFooter string FirstHeader string }+
Same as above, the exported struct needs to have a corresponding comment.
comment created time in 2 months