Writing data to a formatted file.

Discussion in 'iOS Programming' started by techwoman, Jan 21, 2017.

  1. techwoman macrumors newbie

    Nov 22, 2014
    I have an app idea where my app would be reading the data from somewhere and then I would write it to a specific file. The user can then open this file on their mobile device to see it's contents, so the file should be mobile device supported.

    This is not the exact app idea, but just an example. My app reads the name and other details of the user from somewhere and then writes/fills it up in a Word document. The word document is of a specific format which may have text and textfields across it to fill up the details. Something like:

    Phone #:

    There would be text field across Name, Address and Phone #. Whatever data my app reads would be pasted in those text fields. I can add this formatted file in the app bundle.

    Is there a way in iOS to write to a file in the specific format? I haven't came across anything as such.
  2. bjet767 macrumors 6502a

    Oct 2, 2010

    But are you stating a file format already established, like PDF, Word, Excel, CSV...?

    If the answer is yes then you will find many examples of how its done in Github.

    Apple's UIDocumenrt/NSDocument object is very rich in it's abilities to read and write data. Do you want an ASCII based file data structure which any app can read or a data stream?

    Start searching the web for example code.

    Here's a link from Microsoft about the Word file format standard:

Share This Page