ContentBlock

class

Represents a single paragraph. Each ContentBlock carries paragraph-level formatting (alignment, list type, indent, spacing) plus a collection of ContentRun objects for the inline content.

PropertyTypeDescription
Type ContentBlockType Always Paragraph in the current version.
Runs IEnumerable<ContentRun> The inline runs within this paragraph, in order.
Alignment TextAlignment? Paragraph alignment: Left, Center, Right, Justified, Auto. Null if using the document default.
ListType ListType? Bullet, Numbered, or None. Null if not a list item.
ListLevel int? Zero-based nesting level of the list item. Null if not a list item.
BlockIndent float? Additional left indent in pixels beyond the normal margin. Null if not indented.
LineSpacing float? Line spacing multiplier (e.g., 1.5 = 150%). Null if using the default (1.0).

ContentRun

class

Represents a contiguous range of text with a uniform style, or a single inline image. Check IsImage to distinguish text from image runs.

PropertyTypeDescription
Text string The text content. Never contains U+2029. For image runs, this is null.
Style IStyle The fully merged style. All properties reflect the actual applied values — safe to read without null-checking if the document has a complete default style.
IsImage bool True when this run represents an inline image. False for text runs.
ImageData byte[] PNG-encoded image bytes. Non-null only when IsImage == true.
ImageWidth float Display width of the image in pixels.
ImageHeight float Display height of the image in pixels.
Fully Merged Style ContentRun.Style is the result of merging the document default style with all per-run overrides. You do not need to resolve inheritance — just read the properties directly in your exporter.

ContentBlockType

enum
Paragraph

Currently only Paragraph is emitted. Future versions may add Table, PageBreak, etc.

Export Pattern Example

foreach (var block in reader.GetContent())
{
    // Determine paragraph tag
    string tag = block.ListType != null ? "li" : "p";
    sb.Append($"<{tag}");

    // Add alignment style
    if (block.Alignment == TextAlignment.Center)
        sb.Append(" style=\"text-align:center\"");

    sb.Append(">");

    // Emit runs
    foreach (var run in block.Runs)
    {
        if (run.IsImage)
        {
            string b64 = Convert.ToBase64String(run.ImageData);
            sb.Append($"<img src=\"data:image/png;base64,{b64}\" "
                    + $"width=\"{run.ImageWidth}\" height=\"{run.ImageHeight}\">");
        }
        else
        {
            bool bold = run.Style.FontWeight >= 700;
            if (bold) sb.Append("<strong>");
            sb.Append(WebUtility.HtmlEncode(run.Text));
            if (bold) sb.Append("</strong>");
        }
    }

    sb.Append($"</{tag}>");
}