3

I need the excel file in which Header has background color,text color, but I am not able to do so. I am able to create csv file which can't be customized. i tried to create the .xml file too but in any way I am not able to create the customized one as per the format.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Janmenjaya
  • 4,149
  • 1
  • 23
  • 43
  • 1
    If you really able to create xls file from objective-c cocoa, please share the code with us. – Anoop Vaidya Mar 07 '13 at 11:39
  • Actually I am not able to create .xls file, but I have created .csv file. I can share the code but I don't have enough reputation to post own answer within 8 hours, so I am trying to answer here in parts – Janmenjaya Mar 07 '13 at 12:09
  • 1
    NSString *csvString =@"ID,DATE,NATURE,MONTANT TTC,DEVISE"; for(int i=0;i<5 ;i++){ NSString *strTemp =[NSString stringWithFormat:@"%@,%@,%@,%@,%@", [NSString stringWithFormat:@"%@",@"1"], [NSString stringWithFormat:@"%@ ",@"18/02/2013"],[NSString stringWithFormat:@"%@ ",@"Taxi"], [NSString stringWithFormat:@"%@ ",@"234"], [NSString stringWithFormat:@"%@ ",@"$"]]; csvString = [NSString stringWithFormat:@"%@ \n %@",csvString,strTemp]; } – Janmenjaya Mar 07 '13 at 12:12
  • Here in above code we are making the whole spread sheet data as a string i.e csvString – Janmenjaya Mar 07 '13 at 12:15
  • NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSLog(@"Document Dir: %@",documentsDirectory); NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.csv", @"userdata"]]; //add our file to the path [fileManager createFileAtPath:fullPath contents:[csvString dataUsingEncoding:NSUTF8StringEncoding] attributes:nil]; – Janmenjaya Mar 07 '13 at 12:17
  • And here in the above code we are creating the .csv file and saving it in document directory. – Janmenjaya Mar 07 '13 at 12:18
  • Hey don't get upset about points. Edit others questinons and you will get 2 points :) I know till now xls file cant be created. So I wondered from where and how you got. – Anoop Vaidya Mar 07 '13 at 12:42
  • http://stackoverflow.com/questions/3587004/is-there-a-library-or-example-for-creating-excel-xlsx-files/21829735#21829735 – Ashish Kakkad Feb 17 '14 at 13:01

0 Answers0