
Need help on save texts format by Textout to a text file
There are probably various possible solutions for saving "the texts in
memory to a file", but first, perhaps it would help for us to have a bit
more clarification.
Since you know you want to use TextOut or similar function to generate the
report, would the TextOut use the data before it is written to the text file
or would it be used to process the data from the text file that has been
stored in it? In other words, if the TextOut uses the data before the data
is written to the text file, then the output of TextOut would be stored in
the text file. This is probably not what you are trying to do, since it is
essentially not possible.
So I am assuming that the text file will consist of the text as well as
coordinates and other formatting information. Does that sound correct? So
for printing you want to pre-process the data and store a summarized version
of it that consists of just text and related data for printing in the new
format? If so, then you will need a separate function that reads the
generated data and formats it using specialized processing, correct? If so,
then it is probably possible to do that except it is probably also possible
to bypass the temporary file.
Quote:
> Hi, Jason,
> Thanks for the reply.
> The reason I don't want to save it to a file before printing is
> because I am doing modication on a existing code base. The original
> code is written as writing texts to printer's DC. I'd like to make
> minimum changes on the original code. It would be the best if there is
> any way I can use to directly save the texts in memory to a file. I
> was trying to find something like a text printer with no success.
> Wendy
Quote:
> > Is there some reason why you can't just save the data in a file, then
load
> > the file and print? Or do you want this report to be printed by some
other
> > app?
> > Jase
> > > Thanks for your help. Here is my situation:
> > > I have an dialog based application which prints a text report. The
> > > text report will not display on the screen. It is composed and sent to
> > > printer by using MFC function TextOut and passing printer's device
> > > context to TextOut.
> > > What I want to do is to add a functionality of saving the report to a
> > > text file while still keeping the ability to print it directly to
> > > printer. The reason that I don't want to accomplish it by changing
> > > TextOut to fprintf is because during composing the text report, x/y
> > > coordinate is used to decide where the texts will go on the report and
> > > I want to keep it that way.
> > > Could anybody help me on this?