OFFICE-onlyoffice

onlyoffice简介
onlyoffice是一个在线创建,编辑和协作文档服务
使用方法

1.给编辑器添加一个div占位空间,其中将传递有关编辑器参数的所有信息:

< div  id = “placeholder” >  
< script  type = “text / javascript”  
  src = “http://documentserver/web-apps/apps/api/documents/api.js” >

2.创建docEditor:

var docEditor = new DocsAPI.DocEditor(“placeholder”,config);

3.其中config是一个对象,全部属性配置如下:

       # Full #

        config = {
            type: 'desktop or mobile',
            width: '100% by default',
            height: '100% by default',
            documentType: 'text' | 'spreadsheet' | 'presentation',
            document: {
                title: 'document title',
                url: 'document url'
                fileType: 'document file type',
                options: ,
                key: 'key',
                vkey: 'vkey',
                info: {
                    author: 'author name',
                    folder: 'path to document',
                    created: '',
                    sharingSettings: [
                        {
                            user: 'user name',
                            permissions: '',
                            isLink: false
                        },
                        ...
                    ]
                },
                permissions: {
                    edit: , // default = true
                    download: , // default = true
                    reader: ,
                    review: , // default = edit
                    print: , // default = true
                    rename: , // default = false
                    changeHistory: , // default = false
                    comment:  // default = edit
                }
            },
            editorConfig: {
                mode: 'view or edit',
                lang: ,
                location: ,
                canCoAuthoring: ,
                canBackToFolder:  - deprecated. use "customization.goback" parameter,
                createUrl: 'create document url', 
                sharingSettingsUrl: 'document sharing settings url',
                fileChoiceUrl: 'mail merge sources url',
                callbackUrl: ,
                mergeFolderUrl: 'folder for saving merged file',
                licenseUrl: ,
                customerId: ,

                user: {
                    id: 'user id',
                    name: 'user name'
                },
                recent: [
                    {
                        title: 'document title',
                        url: 'document url',
                        folder: 'path to document'
                    },
                    ...
                ],
                templates: [
                    {
                        name: 'template name',
                        icon: 'template icon url',
                        url: 'http://...'
                    },
                    ...
                ],
                customization: {
                    logo: {
                        image: url,
                        imageEmbedded: url,
                        url: http://...
                    },
                    backgroundColor: 'header background color',
                    textColor: 'header text color',
                    customer: {
                        name: 'SuperPuper',
                        address: 'New-York, 125f-25',
                        mail: '[email protected]',
                        www: 'www.superpuper.com',
                        info: 'Some info',
                        logo: ''
                    },
                    about: true,
                    feedback: {
                        visible: false,
                        url: http://...
                    },
                    goback: {
                        url: 'http://...',
                        text: 'Go to London'
                    },
                    chat: true,
                    comments: true,
                    zoom: 100,
                    compactToolbar: false,
                    leftMenu: true,
                    rightMenu: true,
                    toolbar: true,
                    header: true,
                    statusBar: true,
                    autosave: true,
                    forcesave: false,
                    commentAuthorOnly: false,
                    showReviewChanges: false
                },
                plugins: {
                    autoStartGuid: 'asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}',
                    url: '../../../../sdkjs-plugins/',
                    pluginsData: [
                        "helloworld/config.json",
                        "chess/config.json",
                        "speech/config.json",
                        "clipart/config.json",
                    ]
                }
            },
            events: {
                'onReady': , // deprecated
                'onAppReady': ,
                'onBack': ,
                'onDocumentStateChange': 
                'onDocumentReady': 
            }
        }

        # Embedded #

        config = {
            type: 'embedded',
            width: '100% by default',
            height: '100% by default',
            documentType: 'text' | 'spreadsheet' | 'presentation',
            document: {
                title: 'document title',
                url: 'document url',
                fileType: 'document file type',
                key: 'key',
                vkey: 'vkey'
            },
            editorConfig: {
                licenseUrl: ,
                customerId: ,
                autostart: 'document',    // action for app's autostart. for presentations default value is 'player'
                embedded: {
                     embedUrl: 'url',
                     fullscreenUrl: 'url',
                     saveUrl: 'url',
                     shareUrl: 'url',
                     toolbarDocked: 'top or bottom'
                }
            },
            events: {
                'onReady': , // deprecated
                'onAppReady': ,
                'onBack': ,
                'onError': ,
                'onDocumentReady': 
            }
        }

4.下面是我写的示例代码:




    
    
    


你可能感兴趣的:(OFFICE-onlyoffice)