如果您能帮我解决这个问题,我将非常感谢,我正在创建一个动态Excel工作表,并且我目前使用 Excel vba
创建了Excel图表。
但是,我正在努力将所有图表和一个额外的工作表导出到一个 pdf
。我有大约15张excel图表和一张excel表格,我需要将其放入一个 pdf
。我需要将Excel工作表作为 pdf
中的第一页。然后通过电子邮件发送 pdf
(全部使用vba)。
答案 0 :(得分:1)
您可以将工作簿发布为PDF,只需确保您的第一页是第一页
-(void)updateUserInformation
{
//
FBRequest *request = [FBRequest requestForGraphPath:@"me/?fields=name,birthday,first_name,location,gender,interested_in,photo"];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error){
NSDictionary *userDictionary = (NSDictionary *)result;
//create URL
NSString *facebookID = userDictionary[@"id"];
NSLog(@"%@",result);
NSURL *pictureURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture?type=large&return_ssl_resources=1", facebookID]];
NSData *imageData = [NSData dataWithContentsOfURL:pictureURL];
// UIImage *fbImage = [UIImage imageWithData:imageData];
NSLog(@"%@",result);
NSMutableDictionary *userProfile = [[NSMutableDictionary alloc] initWithCapacity:8];
NSLog(@"%@",result);
if(userDictionary[@"name"]){
userProfile[kCCUserProfileNameKey] = userDictionary[@"name"];
}
if(userDictionary[@"user_birthday"]){
userProfile[kCCUserProfileBirthdayKey] = userDictionary[@"user_birthday"];
}
if(userDictionary[@"first_name"]){
userProfile[kCCUserProfileFirstNameKey] = userDictionary[@"first_name"];
}
if(userDictionary[@"location"][@"name"]){
userProfile[kCCUserProfileLocationNameKey] = userDictionary[@"location"][@"name"];
}
if(userDictionary[@"gender"]){
userProfile[kCCUserProfileGenderKey] = userDictionary[@"gender"];
}
if(userDictionary[@"interested_in"]){
userProfile[kCCUserProfileInterestedInKey] = userDictionary[@"interested_in"];
}
if([pictureURL absoluteString]){
userProfile[kCCUserProfilePictureURL] = [pictureURL absoluteString];
}
[[PFUser currentUser] setObject: userProfile forKey:kCCUserProfileKey];
[[PFUser currentUser] saveInBackground];
[self requestImage];
}
else{
NSLog(@"Error in FB request %@", error);
}
}];
}
-(void) uploadPFFileToParse:(UIImage *)image
{
NSData *imageData = UIImageJPEGRepresentation(image, 0.8);
if(!imageData){
NSLog(@"imageData was not found");
return;
}
PFFile *photoFile = [PFFile fileWithData:imageData];
[photoFile saveInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
if(succeeded){
PFObject *photo = [PFObject objectWithClassName:kCCPhotoClassKey];
[photo setObject:[PFUser currentUser] forKey:kCCPhotoUserKey];
[photo setObject:photoFile forKey:kCCPhotoPictureKey];
[photo saveInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
NSLog(@"Photo saved successfully");
}];
}
}];
}
-(void) requestImage
{
PFQuery *query = [PFQuery queryWithClassName:kCCPhotoClassKey];
[query whereKey:kCCPhotoUserKey equalTo:[PFUser currentUser]];
[query countObjectsInBackgroundWithBlock:^(int number, NSError * _Nullable error) {
if(number == 0 )
{
PFUser *user = [PFUser currentUser];
self.imageData = [[NSMutableData alloc] init];
NSURL *profilePictureUrl = [NSURL URLWithString:user [kCCUserProfileKey][kCCUserProfilePictureURL]];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:profilePictureUrl cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:4.0f];
NSURLConnection *urlConnection = [[NSURLConnection alloc]initWithRequest:urlRequest delegate:self];
if(!urlConnection){
NSLog(@"Failed to Download Picture");
}
}
}];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[self.imageData appendData:data];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
UIImage *profileImage = [UIImage imageWithData:self.imageData];
[self uploadPFFileToParse:profileImage];
}
@end
中的大部分代码