---
title: "Read a DOCX file’s title and author in C#"
url: https://recursiveai.org/onedocument/cookbook/read-docx-document-properties/
description: "Read the title and author stored in a DOCX file in C# without installing Microsoft Word. Includes a runnable OneDocument example and sample file."
version: "1.0.0"
---

# Read a DOCX file’s title and author in C#

**OneDocument** is a free, open-source Word, Excel and PowerPoint document library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneDocument.Documents) · [GitHub](https://github.com/recursive-ai-oss/onedocument-csharp) · [Docs](https://recursiveai.org/onedocument/docs/) · [Download example (.zip)](https://recursiveai.org/onedocument/cookbook/read-docx-document-properties/read-docx-document-properties.zip)

Use `sample.docx` from the zip. Word doesn’t need to be installed.

```shell
dotnet add package RecursiveAI.OneDocument.Documents
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using RecursiveAI.OneDocument.Documents;
using var doc = Document.Open("sample.docx");
var core = doc.Properties.Core;
Console.WriteLine($"Title: {core.Title}");
Console.WriteLine($"Author: {core.Creator}");
```

Unzip [the example](https://recursiveai.org/onedocument/cookbook/read-docx-document-properties/read-docx-document-properties.zip), then `dotnet run`.

```text
Title: Trail notes
Author: Casey Nguyen
```

## The full program

```csharp
using RecursiveAI.OneDocument.Documents;

using var doc = Document.Open("sample.docx");
var core = doc.Properties.Core;
Console.WriteLine($"Title: {core.Title}");
Console.WriteLine($"Author: {core.Creator}");
Console.WriteLine($"Subject: {core.Subject}");
Console.WriteLine($"Last saved by: {core.LastModifiedBy}");
```

`dotnet run` prints:

```text
Title: Trail notes
Author: Casey Nguyen
Subject: Weekend route
Last saved by: Jordan Lee
```

The sample’s body starts with “Pack water and a trail map.” The values printed here come from a separate XML file inside the DOCX, `docProps/core.xml`. Here’s an excerpt:

```xml
<dc:title>Trail notes</dc:title>
<dc:creator>Casey Nguyen</dc:creator>
<dc:subject>Weekend route</dc:subject>
<cp:lastModifiedBy>Jordan Lee</cp:lastModifiedBy>
```

An unset title or author is `null`; OneDocument doesn’t fill it in from the file name or body text.

## Variations

**Label missing metadata.** Replace the two print lines in the snippet at the top with these if you want an explicit fallback:

```csharp
Console.WriteLine(core.Title ?? "(no title saved)");
Console.WriteLine(core.Creator ?? "(no author saved)");
```

## Related recipes

- [Set custom Office document properties](https://recursiveai.org/onedocument/cookbook/set-office-custom-document-properties/)

## The short answer

Open the DOCX with `Document.Open`, then read `doc.Properties.Core.Title` and `doc.Properties.Core.Creator`. `Creator` is the stored author. You don’t need to run Microsoft Word or extract text from the pages; the two values are read from the file’s core properties. The sample records Casey Nguyen as the author and Jordan Lee as the last person to save it, so those two fields print different names.

## How do I view the author of a Word document in C#?

Read `Creator`, not `LastModifiedBy`. In the package, `Creator` maps to `dc:creator`, while `LastModifiedBy` maps to `cp:lastModifiedBy`. If the file has been edited and saved by someone else, both values may be useful. Label them separately rather than treating them as two names for the same field. Both are stored values, not proof of who wrote any particular text. The author attached to a tracked change is a separate record; see [tracked changes](https://recursiveai.org/onedocument/docs/revisions/) if you need that information.

If `Creator` is missing, leave the result blank or give it an explicit label as in the variation. Don’t use the last editor as the missing author: doing so mixes two distinct properties.

## How can I check the metadata for a DOCX file?

Start with `Properties.Core` for common fields such as title, subject, author, and keywords. The title field is not the file name and is not the first heading: in the example `sample.docx`, `Trail notes`, and `Pack water and a trail map.` are three different strings. Decide which value your index or display actually needs before choosing what to read.

The [document properties guide](https://recursiveai.org/onedocument/docs/docx-stories-properties/#document-properties) distinguishes the core, application, and custom property parts. Use the core part for title and author. A custom property is a named field added by an application or user, such as a project code; it belongs in `Properties.Custom`, not in the core title or subject. The program above only reads properties. It never calls `SaveAs`, so it doesn’t write a new copy or update the file’s metadata.
