1

Macアプリ開発初心者です。

nstableview に一連のデータがあり、プログラムによってこのデータを .cs 形式で保存する必要があります。

-(IBAction)exportInvoice:(id)sender
{
    AppDelegate *appDelegate = [NSApp delegate];
     NSString *tempStr = [NSString stringWithFormat:@"%@", [OrderModel getInitialOrderBITToDisplay:[appDelegate getDBPath]]];
    NSArray* commaSeparatedObjects = [tempStr componentsSeparatedByString:@","];
    //NSString *commaSeparatedObjects = [tempStr componentsJoinedByString:@","];
    NSLog(@"%@",commaSeparatedObjects);

    NSSavePanel *pdfSavingDialog = [NSSavePanel savePanel];

    [pdfSavingDialog setRequiredFileType:@"csv"];

    if ( [pdfSavingDialog runModalForDirectory:nil file:nil] == NSOKButton ) {
       // NSData *dataForPDF = [self exportPdfData];
        NSData *dataForPDF = [NSKeyedArchiver archivedDataWithRootObject:commaSeparatedObjects];
        NSLog(@"%@",dataForPDF);
        [dataForPDF writeToFile:[pdfSavingDialog filename] atomically:NO];

    }
}

誰でも問題を整理するのを手伝ってもらえますか?

4

1 に答える 1

2

CHCSVParser を確認してください: https://github.com/davedelong/CHCSVParserお役に立てば幸いです 。

于 2012-11-20T13:05:20.093 に答える