简体   繁体   English

无法通过URL方案从我的iOS应用中打开MS-Excel iOS应用中的excelSheet

[英]Unable to open my excelSheet in MS-Excel iOS app from my iOS app via url scheme

Actually I am following this document to open my excel sheet in iOS MS_EXCEL app from my app via url scheme. 实际上,我正在遵循文档以通过URL方案从我的应用程序在iOS MS_EXCEL应用程序中打开我的Excel工作表。 By using its documentation I open EXCEL app successfully. 通过使用其文档,我成功打开了EXCEL应用程序。 But I am totally unable to open my excel sheet . 但是我完全无法打开我的Excel工作表。 Every time EXCEL app gives me error showing in this image 每次EXCEL应用程序给我该图像中显示的错误

在此处输入图片说明

I am passing my saved file url to Excel app. 我将保存的文件URL传递给Excel应用程序。 I have checked the saved file path by iExplorer. 我已经通过iExplorer检查了保存的文件路径。 That file is perfectly opened . 该文件已完美打开。 But in Excel app, its really giving me headache. 但是在Excel应用程序中,它确实让我头疼。

Please help me out that where am I making Mistake. 请帮我弄清楚我在哪里犯错。 Here my code snippet 这是我的代码段

static NSString * encodeByAddingPercentEscapes(NSString *input) {
NSString *encodedValue =
(NSString *)CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(
                                                    kCFAllocatorDefault,
                                                    (CFStringRef)input,
                                                    NULL,
                                                    (CFStringRef)@"!*'();:@&=+$,/?%#[]",
                                                    kCFStringEncodingUTF8));
return encodedValue;

} }

 -(NSURL*)excelUrlStringForFile:(NSString*)urlFile WithContext:(NSString*)strContext
 {
NSURL *result =[NSURL URLWithString:[[NSString stringWithFormat:@"ms-excel:ofe|u|%@|p|%@|c|%@",encodeByAddingPercentEscapes(urlFile),urlScheme,strContext] stringByAddingPercentEscapesUsingEncoding:4]];
return result;
}

Here If I am not using 'encoding string by NSUTF8StringEncoding ' this above NSURL object result is set to nil. 如果我不使用“通过NSUTF8StringEncoding编码字符串”,则上述NSURL对象result将设置为nil。 So I must have to use encoding. 因此,我必须使用编码。

 NSURL *openExcelURL = [self excelUrlStringForFile:filePath WithContext:str_fileName];
        if([[UIApplication sharedApplication] canOpenURL:openExcelURL])
        {
            [[UIApplication sharedApplication] openURL:openExcelURL];
}

I am in the same situation, I'm trying to open local files from other application, looking into the website where you have seen the excel URL Scheme I found this text. 我处在相同的情况下,我正在尝试从其他应用程序打开本地文件,查看进入您看到我找到此文本的excel URL Scheme的网站。 It looks like you cannot open local files using this method, it is very strange but only it makes reference to OneDrive and SharePoint files... =S 看来您无法使用此方法打开本地文件,这很奇怪,但是只有它引用了OneDrive和SharePoint文件... = S

If someone knows something about this issue would be very useful to us 如果有人对这个问题有所了解,对我们将非常有用

You can enable users who are running Office on an iOS device to open and edit files stored in SharePoint or OneDrive from any application, and then quickly return them to the original application when they're done editing the file. 您可以使在iOS设备上运行Office的用户能够从任何应用程序打开和编辑SharePoint或OneDrive中存储的文件,然后在完成文件编辑后将其快速返回到原始应用程序。 To do this, you pass files to Office via protocol handlers, and you make sure that Office is invoked in a way that Office can understand. 为此,您通过协议处理程序将文件传递给Office,并确保以Office可以理解的方式调用Office。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Swift 3中使用自定义URL方案打开iOS App? - How to open my iOS App with custom URL scheme in Swift 3? 如何在iOS中从MS-Word或MS-Excel打开Excel,Doc - How to open excel, doc from ms-word or ms-excel in iOS 当应用程序使用URL方案在iOS中打开我的应用程序时,如何获取呼叫者的信息 - How to get the caller's info When a app using URL Scheme to open my App in iOS 从我的 iOS 5 应用打开 Twitter 应用 - Open Twitter app from my iOS 5 app 无法通过打开方式从 iOS 文件应用程序打开文件<My App>共享表:提供的文件 URL 中不存在文件 - Cannot open file from iOS Files app via the Open In <My App> share sheet: no file at the provided file URL exists 在 iOS 上通过 URL 方案启动 Viber 应用程序 - Launching Viber app via URL scheme on iOS 你可以从HTTP网址方案打开iOS应用吗? - Can you open an iOS app from an HTTP url scheme? 使用我的 url 方案作为链接从 gmail 打开应用程序 - Open app from gmail with my url scheme as a link 使用我的网址方案作为链接从SMS打开应用程序 - Open app from SMS with my url scheme as a link 我只想打开 MS Outlook 应用程序并在 iOS 上使用 URL Scheme 查看 mailto 屏幕 - I just want to open MS Outlook app and see mailto screen using URL Scheme at iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM