Closed seunggabi closed 7 years ago
@seunggabi What do you mean by "enter key"? are you trying to insert a newline "\n"
in a cell?
Yes, I am
[now..] "asdf"+String.fromCharCode(13)+"asdf" => asdf asdf ====excel file open & cell update====> asdf\nasdf
@SheetJSDev I will wait for your help :)
@seunggabi we will have an answer soon. The different formats treat the character codes 0x0A
and 0x0D
in subtly different ways, mainly because Excel isn't entirely consistent.
@SheetJSDev Thanks you sir.
I understand your word. You told me, it(\n update issue) is not working, however You will have an answer soon. isn't it?
Ok I looked into this a bit. There are two parts.
1) what character should be used?
ODS/FODS accept either \n
or \r
based on my tests, whereas Excel only accepts \r
.
2) how do you get excel to show multiple lines?
If you do that, the cell won't show up in 2 lines but you can select the cell and enable "Wrap Text" (right-click the cell, go to format cells, then "Alignment" tab then check "Wrap Text") and you will see it display as multiple lines.
This is written as part of the cellXfs block which is something we need to support.
@SheetJSDev
Okay, I understand your word. I appreciate your tips No.2
I learned 'Wrap Text' because of you. If I need help, I'll ask you another question.
@SheetJSDev
Thank you! I solved it. cell.s = {wrapText: true}
it is cool!
In case anyone else comes here looking for wrapText, @seunggabi solution was not quite right.
cell.s = {alignment:{ wrapText: true }}
works for me. as seen here:
@gdoteof would you please give an example, it just not work for me.
\r
also not work, I have to click the cell so to split.
bookSST seems unrelated
@gdoteof, Can you please tell me which file do i need to refer for wrapping the text in cell? i am using xlsx.full.min.js. but it is not applying any style for the generated excel file.
@superlbr and @kamthe
Sorry for the messy thoughts here; I am just waking up and haven't really touched any of this in about a year. AND -- it's all very, very messy.
That being said I believe both of your issues are related to the fact that you are using the wrong js-xlsx. There are two (this repo) and and js-xlsx-style which actually has styling semi-well implemented.
Could you please retry either using my fork here: https://github.com/gdoteof/js-xlsx
or the (original?) js-xlsx-style fork here: https://github.com/protobi/js-xlsx
@superlbr the example you are looking for here is here:
https://github.com/protobi/js-xlsx/issues/16
specifically you would be looking to do something like
"A1": {
"v": "CELL TEXT HERE ",
"s": {
"alignment": {
"wrapText": 1,
}
},
"t": "s"
},
@ gdoteof not work yet.
I find an example https://codepen.io/superlbr/pen/bMEXGE?editors=0111, but don't know how it work...
@superlbr if you are just trying to do lines, \n should work fine.
Only use the protobi version if you need styling (colors and borders and stuff)
@ gdoteof use \n , I need to click the cell to edit, then it wrap...
@superlbr sorry I didn't understand. The answer is yes, this will not work for you (this word wrapping is considered styling which is not supported in this. Use the protobi version if you want styling.
Does this one do wwhat you want? https://codepen.io/gdoteof/pen/aGwBrL?editors=1111
yes, it works. Seems little difference between web side and server side.
@gdoteof thanks~ I agree your comment.
Thanks @gdoteof 's demo ! However it seems broken, after fix broken code it work for me ! Using xlsx-style instead of xlsx, and wrap line (A4) work perfect !
thanks @sky172839465 i am not sure why i had that type hinting thing in there that was broken. i updated the gist in case anyone else comes to it
Hello. I have a issue the issue is [enter key] not working cell
asdf[enter]asdf
==== cell update ===> asdf asdf
I don't understand. this was situation.... I need your help..
In fact, I am making Excel Merge Tool(EMT) https://github.com/seunggabi/excel-merge-tool If you help, you can make it successful.
I will wait for your help :)