如何在Excel表格中导出NSImage?将NSImage导出为Excel表格
当我尝试执行下面的操作时,Microsoft Excel应用程序无法读取内容。
NSBitmapImageRep *imageRep = [self.displayView bitmapImageRepForCachingDisplayInRect:[self.displayView bounds]];
[imageRep setSize:self.displayView.frame.size];
[self.displayView cacheDisplayInRect:[self.displayView bounds] toBitmapImageRep:imageRep];
NSImage *image1 = [[NSImage alloc] initWithSize:NSMakeSize(imageRep.pixelsWide, imageRep.pixelsHigh)];
[image1 addRepresentation:imageRep];
[[image1 TIFFRepresentation]
writeToFile:@"AbsolutePath/ExportImageTest.xlsx"atomically:YES];
可以任何一个建议我如何导出视图转换为Excel表格中的NSImage?
一个TIFF不是一个Excel电子表格。你为什么相信用.xlsx编写一个TIFF会将它变成一个? – 2014-10-09 14:49:59
是的,你是对的布拉德,但你可以帮助我在Excel工作表上使用NSImage完成这项工作吗?有没有办法做到这一点? – 2014-10-10 09:36:56