G'day,
Heh. I've only been offshore twice this year, and both times bugs in my code have been found.
Apologies @JD, when I got back onshore I completely forgot to follow up and get the trunk code fixed. And I see CellSpacing has now failed
As i tested, every single char such as 'A', 'B', or '1', '2'... will be empty in saved docx or odt file
@qindj
Right - I've confirmed that indeed there is a bug. I'll get to it, but in the meantime you're going to need to keep appending those spaces.
I'm away from IDE at the moment (Yes, offshore again working 12 hours shifts).
The following are my quick notes to assist with chasing this when I have time. I'm planned to be back on shore Nov 4, so I should reply sometime in the weekend following that. If you haven't heard, ping me (pm or here) and remind me.
The issue is likely in docxvectorialwriter.pas,
Line 703. For some reason AddTextRun doesn't look like it's being run (in the xml of the resulting word document, not only is the there no text, but there's no w:r tag written either, and that's done in AddtextRun). Oh, or AddTextRun is being passed an empty string. Ah, that's makes more sense. If it's being passed with an empty string, then the following code needs to be tightened to ONLY strip CR or LF.
Line 696:
// Strip out the trailing line break
// added by TStringList.Text
If DefaultTextLineBreakStyle = tlbsCRLF Then
sTemp := Copy(sTemp, 1, Length(sTemp) - 2)
Else
sTemp := Copy(sTemp, 1, Length(sTemp) - 1);
If my suspicion is right about that code being overzealous and stripping two chars when there is only one to be stripped, then I'd expect missing characters all over the place. Replacement code for the above should be TrimChars(<string>, [CR, LF]). There will be one floating around somewhere. Not sure, but have to resume work now :-(
Cheers
Mike
UPDATE: OK, I've broken out an IDE. No, it wasn't the above code.
Issue is actually in AddTextRun. I'm parsing over the passed string - looking for internal LF, CR, TAB, so I can turn large collections of text in to actual word paragraphs.
Except, I start my looking at the wrong index :-(
Quick fix:
Line 554 of docxvectorialwriter.pas needs to be changed to:
(it was previously i > iStart, so worked for strings with length > 1)
Better fix:
Mike remembers this time and supplies an actual patch, fixing both this and @JD's issue.