Rafał Gołubowicz
Rafał Gołubowicz

Reputation: 660

C++ : Formatting output text to .doc/.docx/.rtf (PART 2)

In my previous post about output text format to doc/docx i had many answers. All said I need Microsoft Word Automate, but it's a pretty hard. On MSDN isn't any tutorial step by step about this.

Maybe sb know many about this and can help me with that? (basic includes, commands etc.)

I need tutorial step-by-step, because i'm newbie(that i said in the previous post ;p)

Or maybe saving to .rtf file is easier? If yes maybe sb can say about that ? (i'm try to use it, with this code:

fstream file;

    file.open("try.rtf", ios::out | ios::app);
    if(file.good() == true)
    {
        file << "{\rtf Hi!\par Give {\b money}.\par }";
        file.close();
    }

but it doesn't working (creating file, but text in the .rtf file:

{ tf Hi!par Give { money}.par }

:( )

So i don't know to do with this.)

So if somebody know to use word automate/saving to rtf and can help me (step-by-step) write here, please!

Upvotes: 3

Views: 1034

Answers (1)

Laurent
Laurent

Reputation: 842

'\' character is used for escape sequences, so if you want to print it you have to use "\\" in your string instead of '\' .

For example in your code

    file << "{\\rtf Hi!\\par Give {\\b money}.\\par }";

Upvotes: 1

Related Questions