How to escape control characters for excel sheets



  • Hi,
    The excel sheet fails as my data has control characters in it. I am trying to clean up my data but do you know of a good way to do it and possibly include in your code too.
    Thanks.
    Here is the example text: square thing is DC3 character.
    <c t="inlineStr"><is><t>Rule 20B  Design and construction of conduit and substructure to carry electric and communications for PG&E, AT&T and Comcast. The project will also convert existing City facilities from overhead to the new underground system.</t></is></c>

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error764160_01.xml</logFileName><summary>Errors were detected in file 907e2ff7-1880-4672-a827-14cbf9357d91.xlsx'</summary><additionalInfo><info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info></additionalInfo><removedParts><removedPart>Replaced Part: /xl/worksheets/sheet1.xml part with XML error.  Illegal xml character. Line 3188, column 46.</removedPart></removedParts></recoveryLog>
    

  • administrators

    hi! hmm what is the character that is causing problems in text Rule 20B  Design and construction of conduit and substructure to carry electric and communications for PG&E, AT&T and Comcast. The project will also convert existing City facilities from overhead to the new underground system.? is the &? i think for this case it will be much better if you can provide an example here that we can run and see the error in live and recommend something to fix your excel sheet.



  • The character is DC3. Can I add an image here because that will show the character I am talking about.




  • administrators

    ok, if your data contains these characters i'm not sure what else you can do than cleaning or escaping those characters, i think you can create a helper which does this and you can call it when printing the value in handlebars, probably this link can help you with the logic implementation, you will need to replace those characters with empty string


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.