Skip to content
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

DuplicateRow or InsertRows in table,and quick analysis tool will lost #1980

Open
DehaiWang opened this issue Aug 28, 2024 · 5 comments
Open
Labels
confirmed This issue can be reproduced

Comments

@DehaiWang
Copy link

Description

i insert some rows in the table zone , and quick analysis tool will lost

Steps to reproduce the issue:

package main

import (
	"github.com/xuri/excelize/v2"
	"log"
)

func main() {

	log.SetFlags(log.Lshortfile | log.LstdFlags)

	openFile, err := excelize.OpenFile("aa.xlsx")
	defer openFile.Close()

	if err != nil {
		log.Panicln(err)
		return
	}

	sheetList := openFile.GetSheetList()
	sheetName := sheetList[0]

	rowIndex := 4

	tableList, err := openFile.GetTables(sheetName)
	if err != nil {
		log.Panicln(err)
		return
	}

	tableItem := tableList[0]
	log.Printf("%+v\n", tableItem)

	err = openFile.DuplicateRow(sheetName, rowIndex)
	if err != nil {
		log.Panicln(err)
		return
	}
	
	//nowTime := time.Now().Format(time.DateTime)
	//openFile.SetCellValue(sheetName, "A5", nowTime)
	openFile.Save()

}

Describe the results you received:
image
and then ,quick analysis tool losted

Describe the results you expected:
image

@xuri
Copy link
Member

xuri commented Aug 28, 2024

Thanks for your issue. Which version of the Excelize are you using? Could you provide the workbook attachment without confidential info?

@xuri xuri added the needs more info This issue can't reproduce, need more info label Aug 28, 2024
@DehaiWang
Copy link
Author

DehaiWang commented Aug 28, 2024

@xuri

thanks.

github.com/xuri/excelize/v2 v2.8.1

example workbook
aa.xlsx

image

@xuri xuri added confirmed This issue can be reproduced and removed needs more info This issue can't reproduce, need more info labels Aug 30, 2024
@DehaiWang
Copy link
Author

@xuri excuse me, do have a plan to fix this ? or have other function to do this ?

@xuri
Copy link
Member

xuri commented Sep 4, 2024

Yeah, I need some time to fix this, this is caused by incorrect formula adjust for shared formula. Contributions are welcome. I'll certainly accept that patch if somebody did that.

@pgalbavy-itrs
Copy link

pgalbavy-itrs commented Sep 18, 2024

In a related way, is there any chance any changes that address this could also "move" conditional formatting on InsertRows() ?

Edit: This may be (my) user error. I was using absolute coordinates when setting the conditional formats. I have not made them relative, but I have not yet tested the result as I had already changed the code path to set the formats last...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed This issue can be reproduced
Projects
None yet
Development

No branches or pull requests

3 participants