I'm using the PEAR package Spreadsheet_Excel_Writer for some scripts that I wrote a few years back. We'll be replacing with a more current package in the months ahead, but that's not really an option at the moment. And it's doing something very strange that I need a little help with.

I was asked to display some text in multiple cells, and merge the cells. After some trial and error and some research, I found the only way to do this was by setting the version # to 8 for this package. And sure enough - the colspan and multi-cell display works great! However, after adding that, I also see that some of the special characters (apostrophes, quotes, etc.) have been replaced by blank spaces.

I have tried manually setting the character encoding on the spreadsheet file as well as several different coding options with the character encoding around the text itself, and all to no avail. It's driving me crazy!

I'm wondering if there's a developer out there that's very familiar with that Spreadsheet_Excel_Writer package, and is available to take a look at the problems I'm having?

    I don't know anything about the package, and probably can't help directly, but I did want to check that you're aware that quotes and apostrophes have special meaning in Excel, so you probably need to escape or otherwise sanitize all quotes and apostrophes before feeding them to your Excel converter.

    HTH,

      While I have no familiarity with the PEAR package you refer to, I have had good experiences when using https://github.com/PHPOffice/PHPExcel for spreadsheet creation and manipulation.Though I'm sure after building something in another library, hearing about this doesn't really help. Sorry.

        Could it simply be that you need to escape those characters? I have no experience with that excel writer either, but iirc you should escape single quotes with single quotes when generating csv files for excel. Perhaps the same applies here?

          Write a Reply...