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

Cannot get line breaks to take? #22

Open
dannycampa opened this issue Nov 21, 2014 · 2 comments
Open

Cannot get line breaks to take? #22

dannycampa opened this issue Nov 21, 2014 · 2 comments

Comments

@dannycampa
Copy link

Do you know how to get line breaks working?

Tried \r\n but need to edit and hit enter in the formula bar for it to take.

Tried <br style="mso-data-placement:same-cell;" />, but no dice.

@functionscope
Copy link
Owner

Check out this link

http://stackoverflow.com/questions/10554836/show-multi-line-text-value-in-cells-of-an-xml-excel-document-made-with-c-sharp-x

If you create a simple Excel file with some multi-line contant and save as
XML you can see this in the output:

In the tag

<Style ss:ID="s62"> </Style>

Cell XML:

First Line Second
Line Last Line

You need to prepare a style with ss:WrapText="1
And replace all new line characters with &#10 in your beforeCellWrite
callback.

On Thu, Nov 20, 2014 at 7:25 PM, dannycampa [email protected]
wrote:

Do you know how to get line breaks working?

Tried \r\n but need to edit and hit enter in the formula bar for it to
take.

Tried
, but no dice.


Reply to this email directly or view it on GitHub
#22.

@alspringsteen
Copy link

In case anyone else is running into this, here's an example style sheet (I changed the file type from xml to txt in order to upload it):

styles.txt

I'm using \r\n for the line breaks. Use styleIndex 3 to create word wrapping.

Example:
beforeCellWrite: function() {
return function(row, cellData, eOpt) {
eOpt.styleIndex = 3;
return cellData;
}

I couldn't figure out how to do this at first at had to create what I wanted in Excel and then copy the style.xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants