Export Excel - multiple lines in messageBottom or Top

Export Excel - multiple lines in messageBottom or Top

qfardqfard Posts: 3Questions: 1Answers: 0

I have tried multiple ways to have multiple lines using the message top or bottom.

I found the following dating from 2018 and still not working - tried with stripNewlines TRUE and also tried with FALSE.

Can't get anything to show the messages in multiple lines.

messageBottom: function() {
return '\r\n this is the first line preceeded by an empty line' +
'\r\n this is the second line' +
'\r\n \r\n this is the third line preceeded by an empty line';
}

TIA

Answers

  • kthorngrenkthorngren Posts: 21,132Questions: 26Answers: 4,918

    Excel doesn't use \r\n for new lines. See this thread for my solution to create new lines in Excel.

    Kevin

  • qfardqfard Posts: 3Questions: 1Answers: 0

    please excuse my ignorance but I am new to this product.

    These posts are talking about the cell info but I rather want to have Top & Bottom message with multiple lines.

    I found this on the forum, so this will not work. correct?

    messageBottom: function() {
    return '\r\n this is the first line preceeded by an empty line' +
    '\r\n this is the second line' +
    '\r\n \r\n this is the third line preceeded by an empty line';
    },

  • kthorngrenkthorngren Posts: 21,132Questions: 26Answers: 4,918
    edited March 2021

    I found this on the forum, so this will not work. correct?

    Is the result that all the text is on one line with \r\n in the cell? Or does nothing appear?

    That code may work for a different type of export, like CSV or PDF, that supports using \r\n for newlines. Excel or more specifically the Open XML Spreadsheet does not use \r\n. Try it for yourself by typing into an Excel cell a string with \r\n.

    Paste this into another cell. Still everything is on one line.

    =CONCATENATE("Line 1",  CHAR(10),  "Line 2")
    

    Next format that cell and under Alignment select Wrap text. Now you will see multiple lines. however there is a next step of changing the row size to see the text.

    These steps need to take place programmatically, which is what that thread shows. Unfortunately its not easy.

    In the Excel export customize function you can insert a row, in place of using messageTop, to provide a multiline message.

    Kevin

  • qfardqfard Posts: 3Questions: 1Answers: 0

    Thank you again.

    Is there an example to accomplish the Excel export part (adding new rows) - is there a callback function?

This discussion has been closed.