Berry.Docx.Visual 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Berry.Docx.Visual --version 1.0.0
NuGet\Install-Package Berry.Docx.Visual -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Berry.Docx.Visual" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Berry.Docx.Visual --version 1.0.0
#r "nuget: Berry.Docx.Visual, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Berry.Docx.Visual as a Cake Addin
#addin nuget:?package=Berry.Docx.Visual&version=1.0.0

// Install Berry.Docx.Visual as a Cake Tool
#tool nuget:?package=Berry.Docx.Visual&version=1.0.0

Berry.Docx.Visual

Downloads

一款用于构建 DOCX 文档在显示时的组成结构的 .NET 库。通过此项目,我们可以知道文档有多少个页面,页面有哪些段落,段落有哪些行和字符,以及这些内容的尺寸和边距。

A.NET library for building the structure of a DOCX document when it is displayed. From this project, we can know how many pages the document has, what paragraphs the page has, what lines and characters the paragraphs have, and the dimensions and margins of these contents.

本项目的计算结果是参照文档在 Microsoft Office Word 2016 的显示效果而生成的。由于无从得知 Word 的渲染方案,所以不保证结果与其一致。目前仅支持段落中的文本,后续会支持图片以及表格等内容。

The calculation result of this project is generated by referring to the document display effect in Microsoft Office Word 2016. Since Word's rendering scheme is not known, there is no guarantee that the results will be consistent. Currently, only text in paragraphs is supported. Later, pictures and tables will be supported.

如果你想快速了解显示效果,可以查看 Berry.DocxViewer 项目,这是一款 WPF 控件库,支持浏览 DOCX 文档。

If you want to get a quick look at the display effect, please check Berry. DocxViewer project, that's a WPF control library, supports browsing DOCX documents.

程序包(Packages)

Berry.Docx.Visual 的 NuGet 软件包发布在NuGet.org上:

The release NuGet packages for Berry.Docx.Visual are on NuGet.org:

Package Download
Berry.Docx.Visual NuGet

示例(Examples)

下面的示例演示如何读取文档中的结构:

The following example shows how to read the document structure:

using Berry.Docx.Visual;

using(Berry.Docx.Document doc = new Berry.Docx.Document("example.docx"))
{
    Document visualDoc = new Document(doc);
    // get first page
    var page1 = visualDoc.Pages[0];
    Console.WriteLine(page1.Width);
    Console.WriteLine(page1.Height);
    Console.WriteLine(page1.Padding);
    // get first paragraph
    var paragraph1 = page1.Paragraphs[0];
    Console.WriteLine(paragraph1.Padding);
    // get first line
    var line1 = paragraph1.Lines[0];
    Console.WriteLine(line1.Height);
    Console.WriteLine(line1.HorizontalAlignment);
    // get first character
    var char1 = line1.Characters[0];
    Console.WriteLine(char1.Val);
    Console.WriteLine(char1.Width);
    Console.WriteLine(char1.Height);
}

更新日志(Release History)

v1.0.0 (2023-05-29)

  • 支持页面、段落和文本字符 (Supports pages、paragraphs and characters)。
Product Compatible and additional computed target framework versions.
.NET Framework net35 is compatible.  net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Berry.Docx.Visual:

Package Downloads
Berry.DocxViewer

一款用于浏览 Word 2007+ (.docx) 文档的 WPF 控件库,基于 Berry.Docx.Visual 项目开发。 A WPF control library for browsing Word 2007+ (.docx) documents, based on Berry.Docx.Visual.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 201 6/16/2023
1.0.1 126 6/2/2023
1.0.0 124 5/29/2023

支持页面、段落和文本字符 (Supports pages、paragraphs and characters)。