【发布时间】:2012-03-18 02:14:27
【问题描述】:
嗨
我已经设法通过将文档类型添加到项目构建并将类型字段设置为“com.microsoft.excel.xls”(参见屏幕截图)来打开邮件应用程序中的 .xls 文件。
我想对 xlsx 文件做同样的事情,但做不到。我尝试添加“com.microsoft.excel.xlsx”,但没有成功
【问题讨论】:
-
我被这个问题困住了!!!
嗨
我已经设法通过将文档类型添加到项目构建并将类型字段设置为“com.microsoft.excel.xls”(参见屏幕截图)来打开邮件应用程序中的 .xls 文件。
我想对 xlsx 文件做同样的事情,但做不到。我尝试添加“com.microsoft.excel.xlsx”,但没有成功
【问题讨论】:
XLSX 文件的标识符是org.openxmlformats.spreadsheetml.sheet
【讨论】:
XSLX 已经声明为org.openxmlformats.presentationml.presentation
【讨论】:
我通过如下定义自定义 UTI 解决了这个问题。尝试将这些定义添加到您的 info.plist 中。它按预期工作。
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeDescription</key>
<string>XLSX input table document</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>xlsx</string>
<key>public.mime-type</key>
<string>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</string>
</dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeIdentifier</key>
<string>com.mydomain.myapplication.xlsx</string>
</dict>
</array>
....
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>XLSX input table document</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.mydomain.myapplication.xlsx</string>
</array>
</dict>
</array>
【讨论】: