dream-num / univer

Univer is an open-source alternative to Google Sheets, Slides, and Docs
https://univer.ai
Apache License 2.0
5.73k stars 474 forks source link

[Bug] use border will return not correct cellData #2578

Closed lyking90 closed 2 weeks ago

lyking90 commented 2 weeks ago

在您提交此问题之前,您是否检查了以下内容?

受影响的包和版本

0.1.15

复现链接

https://univer.ai/playground?title=Vue+3 官方demo可复现, 在操作表格时,只要使用了border边框,univerAPI.getActiveWorkbook().getSnapshot()返回的数据,cellData里会有多余的列和行。会带上一个空的样式,不知道这是特意设计还是bug? 比如我只设计了两行三列,但是加上border后,cellData的数据会有三行五列

预期行为

返回的数据应该与设计的表格数据行为一致,没有多余的数据

实际行为

image

运行环境

Chrome

系统信息

No response

univer-bot[bot] commented 2 weeks ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: [Bug] use border will return not correct cellData

Title: [Bug] use border will return not correct cellData


Before you submitted this question, did you check the following?

Affected packages and versions

0.1.15

Recurrence link

https://univer.ai/playground?title=Vue+3 The official demo can be reproduced. When operating a table, as long as the border is used, the data returned by universalAPI.getActiveWorkbook().getSnapshot() will have extra columns and rows in cellData. It will bring an empty style. I don’t know if this is a deliberate design or a bug? For example, I only designed two rows and three columns, but after adding the border, the cellData data will have three rows and five columns.

Expected behavior

The returned data should be consistent with the designed table data behavior, without redundant data

Actual behavior

image

Running environment

Chrome

system message

No response

Dushusir commented 2 weeks ago

This is the design. Because a border can only be determined by a cell configuration, to set a border for a range, you need to clear the original borders around the range. Clearing the border will also set a new style for the surrounding areas. This is not a bug at the moment, and we will consider optimizing the storage of styles later.