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

type of string cell written by stream writer cannot be shared string #1377

Closed
eaglexiang opened this issue Oct 24, 2022 · 4 comments
Closed
Labels
enhancement New feature or request

Comments

@eaglexiang
Copy link
Contributor

eaglexiang commented Oct 24, 2022

Description

We find the default Type of string cell is str which means formula string. Is there any reason let excelize handle it like this? How can I set it as s( meaning shared string) with stream writer?

func setCellStr(value string) (t string, v string, ns xml.Attr) {

t, v = "str", bstrMarshal(value)

image

Steps to reproduce the issue:
1.
2.
3.

Describe the results you received:

Describe the results you expected:

Output of go version:

(paste your output here)

Excelize version or commit ID:

(paste here)

Environment details (OS, Microsoft Excel™ version, physical, etc.):

@xuri
Copy link
Member

xuri commented Oct 24, 2022

Thanks for your issue. Stream writer writes string cell as str type instead of storing the cell value in SST (shared strings table), this avoids operation SST for reduced memory usage and time cost. Yes, this doesn't follow the specification. If you depend on this type or have any other problems, I would consider changing it to the inlineStr. But anyway, the normal mode function will store the value in SST, and the cell type in this mode is s.

@eaglexiang
Copy link
Contributor Author

eaglexiang commented Oct 24, 2022

In our scene, mem cost of normal mode is unacceptable, and str is also unacceptable. Could you support s or inlineStr in stream write mode? Thanks!

@xuri xuri added the enhancement New feature or request label Oct 24, 2022
@xuri xuri closed this as completed in f44153e Oct 25, 2022
@xuri
Copy link
Member

xuri commented Oct 25, 2022

I have changed the stream writer to write inline string type for string cell value. Please upgrade to the master branch code, and this change will be released in the next version.

@eaglexiang
Copy link
Contributor Author

eaglexiang commented Oct 25, 2022

It works. Thank you so much! :D

xuri added a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
…string cell value

- Add `CellTypeFormula`, `CellTypeInlineString`, `CellTypeSharedString` and remove `CellTypeString` in `CellType` enumeration
- Unit tests updated
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
…string cell value

- Add `CellTypeFormula`, `CellTypeInlineString`, `CellTypeSharedString` and remove `CellTypeString` in `CellType` enumeration
- Unit tests updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants