How to create .doc file or word processor in iOS application?

放肆的年华 提交于 2019-11-29 15:10:43

Try the libopc open source library, which according to their website is a:

  • ISO/IEC 29500 standard conformant,
  • cross-platform,
  • open source,
  • standard C99-based

implementation of Part II (OPC) and Part III (MCE) of the ISO/IEC 29500 specification (OOXML).

- (NSString*)generate_Doc:(Projects *)project AndCompanyInformation:(CompanyInfo*)companyInfo;
{


    NSDateFormatter *date_formater=[[NSDateFormatter alloc]init];
    [date_formater setDateFormat:@"dd-MM-YYYY hh:mm"];
    [date_formater setTimeZone:[DefaultDataManager AppTimeZone]];
    NSDate *now = [DefaultDataManager AppCurrentTime];

    NSString *fileName =  [NSString stringWithFormat:@"%@ %@ %@.doc",project.title,project.reference,[date_formater stringFromDate:now]];
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *docFileName = [documentsDirectory stringByAppendingPathComponent:fileName];





NSData *data = [docString dataFromRange:(NSRange){0, [docString length]} documentAttributes:@{NSDocumentTypeDocumentAttribute: NSRTFTextDocumentType} error:NULL];
    [data writeToFile:docFileName atomically:YES];

 return docFileName;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!