Web ビューの innerhtml を取得して doc 拡張ファイルを作成し、それをメールで送信して、クイック office2 に html タグを提供する場合、誰でもその問題を解決するのを手伝ってくれますか?
これは私のコードです:----
-(void)sendMail { MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init]; [mailController setSubject:@"Mobile Office Pro からファイルを送信中"]; mailController.mailComposeDelegate = 自己;
NSMutableString *strDirectory = [NSMutableString string];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
[strDirectory setString:documentsDirectory];
if ([[[Manager sharedManager] arrGlobal] count]>0)
{
[strDirectory appendString:[NSString stringWithFormat:@"/%@",[[[[Manager sharedManager]arrGlobal]objectAtIndex:[[[Manager sharedManager]arrGlobal] count]-1]valueForKey:@"DirPath"]]];
}
NSArray *arrFilesToMove = [[NSArray alloc] initWithArray:arrForMoveItems];
NSString *pathToCopyFrom = strDirectory;
NSData *myData = [NSData dataWithContentsOfFile:[NSString stringWithFormat:@"%@/%@",pathToCopyFrom,[arrFilesToMove objectAtIndex:0]]];
NSString *mimeType ;
if ([[[arrForMoveItems objectAtIndex:0] pathExtension] isEqualToString:@"csv"])
{
mimeType = @"application/xlsx";
}
else if([[[arrForMoveItems objectAtIndex:0] pathExtension] isEqualToString:@"doc"])
{
mimeType = @"application/msword";
}
else if([[[arrForMoveItems objectAtIndex:0] pathExtension] isEqualToString:@"ppt"])
{
mimeType = @"application/vnd.openxmlformats-officedocument.presentationml.presentation";
}
else
{
mimeType = @"application/pdf";
}
[mailController addAttachmentData:myData mimeType:mimeType fileName:[arrForMoveItems objectAtIndex:0]];
NSString *emailBody = @"Please find attachment generated by Mobile Office Pro for iPhone";
[mailController setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:mailController animated:YES];
}