Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
dhinakaran123
Posts: 16
Registered: ‎06-16-2011
My Device: Blackberry Playbook

Create .dc file in Playbook

Hi All,

 

 

    I can't write data into the .doc file in the  Playbook. I am using the following line.

 

var file:File = File.userDirectory.resolvePath("shared/downloads/testdoc1.doc");
                    if(file.exists)
                        file.deleteFile();
                    var stream:FileStream = new FileStream();
                    stream.open(file, FileMode.WRITE);
                    stream.writeObject(responseMsg.data);
                    stream.close();

 

File has to generated, data also write, file size also varied, data is not a readable format. What is my mistake?

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Create .dc file in Playbook

You don't describe your problem very well, as you haven't said whether you're getting an error message, what it is, what the symptoms are, etc.

I'm guessing you haven't specified the "access_shared" permission in your blackberry-tablet.xml file. If you don't know what that is, a search in this forum will quickly get you the answer.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Contributor
dhinakaran123
Posts: 16
Registered: ‎06-16-2011
My Device: Blackberry Playbook

Re: Writing data into the .doc file

I have created one .doc file, i write some string data into it. I am tried to open that file vai Word to Go Native Application.I can able to open it but i can't able to read that data.it shows like tilt(small small rectangle) symbol.

Below i mentioned my code.

 

var file:File = File.userDirectory.resolvePath("shared/downloads/testdoc.doc");
                    if(file.exists)
                        file.deleteFile();
                    var stream:FileStream = new FileStream();
                    stream.open(file, FileMode.WRITE);
                    stream..writeUTFresponseMsg.data);
                    stream.close();

Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10

Re: Writing data into the .doc file

It sounds like you are trying to write text data (e.g. "this is some text") into a .doc file and expect Word To Go to be able to open it.  That's not going to work.

 

The .doc file format is a binary format.  You'll have to write or find a library that can generate the correct data.  Better would be to use the .docx format, though that's still not a simple text format.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!