0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

開発者向けONLYOFFICE Docs 9.0:APIの更新

Posted at

最新版リリースのONLYOFFICE Docsがリリースされました。機能強化、カスタマイズ性向上、パフォーマンス改善などを中心に、開発者・インテグレーター向けのAPIも大幅に拡充されています。以下で詳細をご確認ください。

image.png

ダイアグラムビューア

ウェブ、デスクトップ、モバイルウェブで利用できる図表ビューアが追加されました。サードパーティアプリ不要でダイアグラムファイルを開けます。

APIでの設定diagramドキュメントタイプをdocumentTypeパラメータに追加。

image.png

対応ファイル形式の拡充

バージョン9.0ではMarkdown(.md)およびOpenDocument Graphic(.odg)ファイルの閲覧が可能になりました。

APIでの設定:mdodgを開く設定を追加。

さらに図表ビューアの登場に伴い、vsdm/vsdx/vssm/vssx/vstm/vstx形式への変換もサポートしています。APIリファレンスをご覧ください。

image.png

カスタマイズオプションの強化

バージョン9.0ではUIテーマやフォント設定など、エンドユーザー向けのカスタマイズ性がさらに向上しました。

新UIテーマ

「モダンライト」と「モダンダーク」の2つのテーマを追加。

APIでの設定theme-whiteおよびtheme-nightテーマIDをeditorConfig.customization.uiThemeに追加。

const config = {
  editorConfig: {
    customization: {
      uiTheme: "theme-white",
      …
    }
  }
};

image.png

簡体字中国語UI向けフォントサイズ選択

西欧フォントと繁体字フォントを切り替え可能に。

APIでの設定editorConfig.customization.forceWesternFontSize(デフォルト:false)

const config = {
  editorConfig: {
    customization: {
      forceWesternFontSize: false,
      …
    }
  }
};

ユーザーアバター非表示

ヘッダーのユーザーアバターを非表示にして、よりシンプルなインターフェースを実現。

APIでの設定editorConfig.customization.layout.header.user(デフォルト:true)

const config = {
  editorConfig: {
    customization: {
      layout: {
        header: {
          user: true,
          …
        }
      }
    }
  }
};

プリロードによるパフォーマンス向上

静的アセット(HTML、CSS、JS、フォント)を事前にブラウザキャッシュへ読み込むことで、初回のドキュメントエディター起動を高速化できます。APIリファレンス

  1. ?preload=placeholder パラメータ利用

    <div id="placeholder"></div>
    <script src="https://documentserver/web-apps/apps/api/documents/api.js?preload=placeholder"></script>
    
  2. プリロード用 iframe の挿入

    <iframe src="https://documentserver/web-apps/apps/api/documents/preload.html" style="display:none;"></iframe>
    

今すぐダウンロード

プラグイン&マクロ向けAPI強化

コンテンツコントロール用カスタムボタン

Asc.ButtonContentControlクラスを使い、自作アイコン付きボタンをメソッドattachOnClickで実装可能。APIリファレンス

(function(window){
  window.Asc.plugin.init = function() {
    let btn = new Asc.ButtonContentControl();
    btn.icons = '/resources/check%scale%(default).png';
    btn.attachOnClick(id => Asc.plugin.executeMethod("RemoveContentControl", [id]));
    …
  }
})(window);

スライド移動(GoToSlide)

プレゼンテーション内で任意のスライドにジャンプ。

expression.GoToSlide(slideNumber);

ContentControlListElement 列挙型

ドキュメント内のコンテンツコントロール管理がさらに簡単に。

非同期計算対応カスタム関数

マクロで定義したカスタム関数内でfetchなどの非同期処理が可能に。例:World Bank APIから人口取得

async function WB(country, indicator, year) {
  const url = `https://api.worldbank.org/v2/country/${country}/indicator/${indicator}?format=json&per_page=20000`;
  try {
    const res = await fetch(url);
    const [meta, data] = await res.json();
    const row = data.find(v => v.date === year.toString());
    return row?.value ?? "#N/A";
  } catch {
    return "#ERROR";
  }
}
Api.AddCustomFunction(WB);

新サンプル追加

Document Builder サンプル

マクロサンプル

すべてのマクロサンプルを見る

Office JavaScript API の追加メソッド

バージョン9.0ではContent Controls、Custom XML、Forms、Custom Properties、Core、Range、Drawing、Presentation、Notes page向けなど、多数の新メソッドが追加されました。新メソッド一覧

お役立ちリンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?