> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I generate a report with a cover page and table of contents?

> Ask for "a cover page, table of contents and page numbers" in style: Doconda adds them to the Word file and its PDF, still editable.

To generate a report with a cover page and table of contents, ask for "a cover page, table of contents and page
numbers" in `style` (or in the same `prompt` sentence) with `format: "docx"`. Doconda adds them to the Word file and
its PDF; the cover page and table of contents are part of the basic style, so they also work with `quality: "fast"`.

## Steps

1. Store your API key in `DOCONDA_API_KEY` and install the SDK (`pip install doconda` or `npm install @doconda/sdk`).
2. Pass your content in Markdown (or a sentence in `prompt`) and the style.
3. Download the Word file and check in `style_applied` that it was understood.

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  from pathlib import Path
  from doconda import Doconda

  doconda = Doconda()  # reads the key from DOCONDA_API_KEY
  doc = doconda.documents.create(
      format="docx",
      content={"markdown": "# Annual report\n\n## Summary\n\n…\n\n## Sales\n\n…\n\n## Next steps\n\n…"},
      style="with a cover page, table of contents and page numbers; dark blue headings; footer: Confidential",
  )
  print(doc["style_applied"])
  Path("report.docx").write_bytes(doconda.documents.download(doc["id"], "docx"))
  ```

  ```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  import { writeFile } from "node:fs/promises"
  import { Doconda } from "@doconda/sdk"

  const doconda = new Doconda()
  const doc = await doconda.documents.create({
    format: "docx",
    content: { markdown: "# Annual report\n\n## Summary\n\n…\n\n## Sales\n\n…\n\n## Next steps\n\n…" },
    style: "with a cover page, table of contents and page numbers; dark blue headings; footer: Confidential",
  })
  console.log(doc.style_applied)
  await writeFile("report.docx", await doconda.documents.download(doc.id, "docx"))
  ```
</CodeGroup>

## What you get back

* An editable Word file with a cover page, table of contents and page numbers, and its PDF.
* `style_applied`: how the style was understood (including `cover_page`, `table_of_contents`, `page_numbers`,
  `header` and `footer`).
* `style_unsupported`: whatever you asked for that couldn't be applied. The rest is applied anyway.
* The style lives in the Word styles (`Normal`, `Heading 1`…), so whatever you add later follows the same design.

## Limits

* With `quality: "fast"` you get the basic style: font, size, colors, alignment, margins, cover page, table of
  contents, header and footer. Charts or a design copied from your template need `standard` or `best`.
* The header and footer are text ("footer: Confidential").

## FAQ

<AccordionGroup>
  <Accordion title="Can it write the report for me?">
    Yes: use `prompt` instead of `content` ("Report on the housing law with a cover page and table of contents"). The
    style in the sentence is applied too.
  </Accordion>

  <Accordion title="Can I add charts?">
    Yes, in `standard` and `best`. See [quality levels](/en/guides/create#quality-levels).
  </Accordion>

  <Accordion title="Can I make it landscape or change the margins?">
    Yes: "landscape", "2 cm margins". See [Style](/en/guides/style).
  </Accordion>
</AccordionGroup>

## Keep reading

* [Style](/en/guides/style) and [Create](/en/guides/create).
* [Quickstart](/en/quickstart).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.