# Column with information about the format size of a document

**URL:** https://resource.dopus.com/t/column-with-information-about-the-format-size-of-a-document/43135
**Category:** Help & Support
**Created:** [December 13, 2022, 9:26pm UTC](https://resource.dopus.com/t/column-with-information-about-the-format-size-of-a-document/43135 "2022-12-13T21:26:26Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![lxp](https://resource.dopus.com/user_avatar/resource.dopus.com/lxp/32/33734_2.png) [@lxp](https://resource.dopus.com/u/lxp)
#### Post date: [December 14, 2022, 8:02am UTC](https://resource.dopus.com/t/column-with-information-about-the-format-size-of-a-document/43135/6 "2022-12-14T08:02:59Z")

</div>

Getting the size of the _first_ page/section is easier than I thought. Care to give this a try?

```javascript
function OnInit(initData) {
    initData.name = 'WordPageSize';
    initData.version = '2022-12-14';
    initData.copyright = '';
    initData.url = 'https://resource.dopus.com/t/column-with-information-about-the-format-size-of-a-document/43135';
    initData.desc = '';
    initData.default_enable = true;
    initData.min_version = '12.0';
}

function OnAddColumns(addColData) {
    var col = addColData.AddColumn();
    col.name = 'WordPageSize';
    col.method = 'OnColumn';
}

var wordApp = new ActiveXObject('Word.Application');

function OnColumn(scriptColData) {
    if (wordApp == null) return;

    var item = scriptColData.item;
    if (item.is_dir) return;
    if (item.ext.substring(0, 4) != '.doc') return;
    if (item.name_stem.substring(0, 1) == '~') return;

    var wordDoc = wordApp.Documents.Open(String(item.realpath));

    var pageW = wordDoc.PageSetup.PageWidth;
    var pageH = wordDoc.PageSetup.PageHeight;
    
    pageW = Math.round(wordApp.PointsToMillimeters(pageW));
    pageH = Math.round(wordApp.PointsToMillimeters(pageH));
    
    wordDoc.Close();
    
    scriptColData.value = pageW + ' x ' + pageH;
}

```

[ColumnWordPageSize.js.txt](https://resource.dopus.com/uploads/short-url/dXQd0IdRklqZljYKnigq3rYZSPJ.txt)

* * *

> [@How to use buttons and scripts from this forum](https://resource.dopus.com/t/how-to-use-buttons-and-scripts-from-this-forum/3546):
>
> This post explains how to add buttons to toolbars and menus, and also applies to raw commands for things like standalone hotkeys. For how to use Script Add-Ins, please scroll down to the post below this one. See Also: The manual has more detail in…

---

_[View the full topic](https://resource.dopus.com/t/column-with-information-about-the-format-size-of-a-document/43135)._
