>  In my case I want to save my chat session in an html file which when
>  double clicked will open the file in the browser and will show all the chat
>  messages with their respective images of the people who are sending the
>  messages. How can I do this? One more thing my application is not document
>  based architecture. Hereby I am attaching the screenshot of my chat window.

  Again, this is a very general question, so you'll get general
answers. Please give this article a read - you're going to have to
post more carefully to get useful feedback from the list. It is a
great resource for getting effective help from technical mailing lists
and is cited in the cocoa-dev list's guidelines:

http://catb.org/~esr/faqs/smart-questions.html

  With that said, I'm assuming you know how to connect your Save As
... menu item to an action. If not, you'll need to review the
introductory Cocoa documentation as you won't get very far without
these basics.

  Assuming you know how to do the above but simply want to know how to
approach the "export" problem, you'll need to create a method that
does the following:

1 - Render as HTML:

  You'll want to render your chat session as HTML somehow. The *easy*
way to do this is to (assuming you know HTML) construct a string that
contains your chat transcript in HTML form. There are many ways to
approach this - if you get stuck, search the documentation and if you
can't find answers, ask specific questions of the list. Note that
you'll probably want to put any stylesheet code *inline* in the
document so it's self-contained *and* pretty. Relying on a separate
.css file is lame. :-)

2 - Save the HTML string to a File:

  You'll need to get that string into a file. This involves prompting
the user with a Save dialog. Read the documentation; this is easy.
Once you have the target path from the user, you'll simply write the
string to a file. See NSString's documentation - this is also easy.

3 - There is no step 3; you're done.

  That's all there is to it. Assuming the file is saved with a .htm or
.html extension, it'll open in the user's default browser if
double-clicked in Finder (or if opened with NSWorkspace's method - see
its documentation, also easy).

  Assuming also your HTML string is well-formed, the web browser will
display your beautifully (or not) rendered chat transcripts.

--
I.S.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to