.NET Framework のセットアップ
Web.config の構成
web.config ファイルに HttpHandler を登録します。
<httpHandlers>
<add verb="GET,POST" path="DocImage.axd" type="Doconut.DocImageHandler, Doconut" />
</httpHandlers><handlers>
<add name="DocImage" verb="GET,POST" path="DocImage.axd" type="Doconut.DocImageHandler, Doconut" />
</handlers>ライセンスの追加
Doconut はルートフォルダーにあるライセンスを自動的に検出します。手動で追加することもできます。
var licenseFilePath = Server.MapPath("~/Doconut.Viewer.lic");
var docViewer = new Viewer(licenseFilePath);web.config 用の構成
web.config ファイルに以下の構成エントリが必要で、Doconut と .NET Framework との互換性を保証します。
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="8.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Drawing.Common" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MessagePack" publicKeyToken="9c7f9b36b37eaddf" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.140.0" newVersion="2.5.140.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>必須な NuGet パッケージ
プロジェクトが Doconut と .NET Framework と完全に互換性を持つように、以下の NuGet パッケージを含める必要があります:
- MessagePack - Version 2.5.140
- MessagePack.Annotations - Version 2.5.140
- Microsoft.Bcl.AsyncInterfaces - Version 8.0.0
- Microsoft.NET.StringTools - Version 17.6.3
- System.Collections.Immutable - Version 6.0.0
- System.Drawing.Common - Version 6.0.0
- System.Memory - Version 4.5.5
- System.Reflection.Emit - Version 4.7.0
- System.Reflection.Emit.Lightweight - Version 4.7.0
- System.Security.Cryptography.Pkcs - Version 8.0.0
- System.Text.Encoding.CodePages - Version 8.0.0
- System.Text.Encodings.Web - Version 8.0.0
- System.Text.Json - Version 8.0.3
レンダー構成オプション
以下のオプションを使用してレンダリング動作を構成できます:
- CadConfig: DWG、DXF、DGN ファイルに使用されます。
- EmailConfig: EML、EMLX、MSG ファイルに使用されます。
- EpubConfig: EPUB ファイルに使用されます。
- ExcelConfig: Excel と CSV ファイルに使用されます。
- MhtConfig: MHT ファイルに使用されます。
- PptConfig: PowerPoint ファイルに使用されます。
- ProjectConfig: MPP ファイルに使用されます。
- PsdConfig: PSD ファイルに使用されます。
- TxtConfig: TXT ファイルに使用されます。
- TiffConfig: TIFF ファイルに使用されます。
var config = new CadConfig { DefaultRender = false }; // or trueWord ドキュメントでのカスタム フォント
WordConfig クラスの FontFolders プロパティは、アプリケーションがフォントを検索するカスタムディレクトリを指定します。
var config = new WordConfig
{
FontFolders = new string[] { "C:\\CustomFonts", "D:\\SharedFonts" }
};NuGet パッケージの AjaxControlToolkit に関する更新
互換性向上のため、NuGet パッケージに変更を加えました。AjaxControlToolkit は現在含まれません。ユーザーはプロジェクトに AjaxControlToolkit バージョン 4.1.50508 を手動でインストールすることが推奨されます。
Doconut 25.2.0 の重要な更新
すべてのプロジェクトで System.Text.Json パッケージをバージョン 8.0.5 に更新することが重要です。
メール エンコーディング
EmailConfig クラスの EmailEncoding プロパティは、メールの件名と本文の両方に推奨されるエンコーディングを指定します。
var emailConfig = new EmailConfig {
EmailEncoding = Encoding.UTF8 // Set preferred email encoding
};件名と本文のエンコーディング
EmailConfig クラスの SubjectEncoding と BodyEncoding プロパティは、メールの件名と本文にそれぞれ使用されるエンコーディングを定義します。
var emailConfig = new EmailConfig {
SubjectEncoding = Encoding.UTF8, // Set encoding for the subject
BodyEncoding = Encoding.UTF8 // Set encoding for the body
};Word ビューアでのカルチャーサポート
WordConfig クラスの DocumentCulture プロパティを使用すると、DOC および DOCX ファイルのカルチャーを明示的に指定できます。これにより、日付、通貨、数値などのローカライズされたコンテンツが Microsoft Word と同じ方式で正確に表示されます。特定の書式設定要件を持つ言語に特に有用です。
var config = new WordConfig { DocumentCulture = "he-IL" }; // Hebrew (Israel)
var config = new WordConfig { DocumentCulture = "ar-SA" }; // Arabic (Saudi Arabia)
var config = new WordConfig { DocumentCulture = "th-TH" }; // Thai (Thailand)
var config = new WordConfig { DocumentCulture = "ja-JP" }; // Japanese (Japan)