Column with information about the format size of a document

Greetings. I once got help on this forum for a similar problem (number of pages in a column). I ask if I could also see the size format of a document. Example : Letter, Legal, B3, A4, etc. Is it possible? Thanks in advance.

It can probably done via scripting (assuming Word is installed), but if the information is available in a column in File Explorer then that may be an easier way to access it, and we can show how to import the same info into Opus.

I'm not sure if Explorer has a column for it though. Couldn't find anything under Page/Paper/Document, at least. Maybe there's another term for it.

1 Like

Rather difficult. It's not even in Microsoft's DocumentProperties available, let alone file metadata. Wouldn't make much sense anyway, as a document with n pages can have up to n different page sizes. So I guess you would need a script that loops through the document and plucks the sizes from the pages.

2 Likes

It makes sense for a document to have pages with different sizes, I mean, it's possible. I asked the question about the presumption of a document with a single page size. Example: Letter. I still find it difficult through metadata, but since Opus designers-programmers are so creative, I was encouraged to ask the question. I would really need it for my work, but I can't help but admit that it's quite difficult. Thanks for watching anyway.

There may be a possibility to use a script, but it would be a long job considering that a document can contain n page layouts, as user lxp exposes.
It would be very convenient to enable the details view and see the number of pages and the page size to send all the documents to print at once without having to open them. Thanks anyway Leo, always very attentive and punctual.

1 Like

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

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


1 Like