hosijyun
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Android Office SDK技术白皮书 2016年5月 [TOC] ## 简介 1. 产品简介 *Android Office SDK* (以下简称`SDK`)是*武汉织云软件有限公司*旗下产品。通过集成SDK,开发者可以在应用中轻易实现查看Office文档功能。SDK包括以下子产品: * OfficeSDK-Word For Android * OfficeSDK-XLS For Android * OfficeSDK-PPT For Android * OfficeSDK-PDF For Android 2. 支持格式 SKD目前支持查看以下Office文档格式: * 电子文档:`.doc` 或 `.docx` 及 `.txt` * 电子表格:`.xls` 或 `.xlsx` * 演示文稿:`.ppt` 或 `.pptx` * PDF文档:`.pdf` ## 开发环境设定 1. 开发所需操作系统: * Windows 7(32/64位) 或 Windows8(32/64位) * Mac OS X 10.5.8 或以上 * Linux 2.6 或以上 2. 开发所需环境: * JDK 6或以上 * 及Android Framework 4.0.3或以上 3. 开发所需工具: * Eclipse 3.4 或以上 * Android Studio 1.5 或以上。 ## 使用示例工程 在进行开发前,我们先向您展示我们提供的示例工程来增加您对SDK的认识。 1. 导入示例工程 我们需要使用开发工具及移动设备来运行示例工程,根据Android官方指引,我们向您推荐使用Android Studio作为开发使用SDK的工具。而较早前因官方已经**不再**推荐使用Eclipse,故此文档中**不再**列出Eclipse示例教程,若有需要,请下载[Eclipse示例工程][eclipse_demo],导入到Eclipse IDE中,可以编译运行OliveOffice SDK演示文档查看功能。 在完成上述*开发环境设定*后,打开Android Studio并导入示例工程。该示例工程在Android Studio *2.1*下创建,在其它版本的Android Studio中可能有兼容性问题。导入工程后,如下图所示: ![示例工程示意图][demo_image] 2. 编译执行示例工程 示例工程中的SDK库文件可能不是最新的,您需要联络我们的[技术支持][support]人员以获取最新的SDK。请将最上图中 *OfficeSDK.jar* 替换为最新的SDK库文件。此时,整个示例工程已可以在模拟器或移动设备中运行。 示例工程的主界面是一个文件浏览器,该文件浏览器将访问您的移动设备的SDCARD目录,并列出所有支持的Office文档及文件夹。您可以选择在移动设备上的文件进行查看。注意,由于是示例工程,查看Office文档时会显示出我司的水印信息。 如下图所示,分别是文件浏览器、查看电子文档、查看电子表格、查看演示文稿: (注:图中按钮作为SDK外控件,用于自定义控制SDK) ![示例工程文件浏览器][demo_explorer]![示例工程电子文档][demo_word]![示例工程电子表格][demo_spreadsheet]![示例工程演示文稿][demo_presentation] ## SDK架构与工作原理 1. Office文档格式简介 微软 Office 文档的存储格式主要分为两种: * Office 97-2003 采用的二进制复合文档格式(简称`03 格式`) * Office 2007 以后的 OpenXML 格式(简称`07 格式`) 2. 实现概览 ![实现概览][sdk_uml] SDK在设计及实现上遵循MVC模式,我们向开发者提供了`文档视图`及`文档控制器`以便开发者能够简单地使用SDK。 2.1. 文档视图:文档视图用于将文档展示给用户,在SDK中以`DocumentView`作为表示。 DocumentView 相当于Android中的自定义控件,其将监听用户的输入及操作,并将计算结果呈现给用户。您可以使用以下代码创建一个 DocumentView : ``` DocumentViewFactory.newWordView(context); DocumentViewFactory.newSpreadsheetView(context); DocumentViewFactory.newPresentationView(context); ``` 值得注意的是,目前SDK未能支持使用XML布局创建文档视图。开发者需要通过判断文档格式来创建对应格式的文档视图,在视图创建完成后,将文档视图加入到要显示的容器View中即可。 2.2. 文档控制器:文档控制器用于开发者控制文档视图。在SDK中以`DocumentViewController`作为表示。 在创建`DocumentView`后,通过以下代码可以获得文档控制器: ``` DocumentView view = ...; DocumentViewController controller = view.getController(); ``` 获得控制器后,此时可以对整个文档视图进行控制。开发者可以通过以下代码打开Office文档: ``` boolean encrypted = controller.checkEncrypted(...); // 传入文件 if(encrypted) ...; /* 处理加密文档 */ else controller.loadFile(..., ...); /* 打开文档 */ ``` 执行上述代码后,Office文档将会把文档呈现到文档视图中,此时基本的打开文档操作已经完成。如需要更多的额外操作,也可以在通过文档控制器来完成,如所缩放文档、监听事件等等。更多的操作请查看Android Office SDK API docs。 ## 正版授权 声明:授权文件是我司保护产品的重要文件,为保证您的应用安全,我们倡导使用正版的SDK进行产品开发。 1. 获取授权文件 请联络我司的商务部门,您可以从商务部门获取价格、服务支持等等信息。在您完成付款后,授权文件将会交付给开发者。 2. 导入授权文件 开发者可以通过以下代码将授权信息导入至SDK中: ``` byte[] licenseData = ...; LicenseData.setLicense(licenseData); ``` 该代码可以在应用启动时执行或者在打开Office文档时执行,仅首次执行有效。 [support]: mailto:hesiyuan@zysoft.com "技术支持" [eclipse_demo]: https://pan.baidu.com/s/1i4THBrZ "Eclipse示例工程" [demo_image]: https://i.imgur.com/OR1mw5h.png "示例工程示意图" [demo_explorer]: https://i.imgur.com/MVnU6Ni.png "示例工程文件浏览器" [demo_word]: https://i.imgur.com/KY9CjYq.png "示例工程WORD" [demo_spreadsheet]: https://i.imgur.com/cTmqp1W.png "示例工程SPREADSHEET" [demo_presentation]: https://i.imgur.com/RdHkvaM.png "示例工程PRESENTATION" [sdk_uml]: https://i.imgur.com/6Y4WSJj.png "SDK MVC"

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully