Jump to content

Recommended Posts

Posted

I'm trying to figure out if there's a way to do what I want to do in Publisher. Basically, I have a CSV file with a bunch of fields. Some of those fields are used to group items under headings, subheadings, etc., and then other fields will be used to put together rows under the headings. So it's not a simple mail merge like creating labels or something. It needs some fairly complex logic. Currently I am doing this in InDesign with an InDesign JSX script that reads the CSV file, does the transformations, and adds the results into a text box that flows across multiple pages (however many are needed) in my document. That document is created from a template that already has the character and paragraph styles I need in order to style the document the way I want (so the script doesn't do any formatting other than applying the styles, which are defined in the template).

I can think of two possible ways to do this, but it's not clear to me that either is possible today in Publisher. One would be to use some kind of script similar to what I'm doing in InDesign to, within Publisher, process the data and place it in a templated file. The second is if the Publisher document format is straightforward and/or documented, I could write code to actually generate the document outside of Publisher. But maybe there are other options as well; I am open-minded about how to achieve this.

Any thoughts on whether this is possible today, or might be at some point in the future? For anyone who cares, here's a blog post I wrote many years ago about the specific thing I'm doing in InDesign (though I have since changed it to just read from a CSV export rather than talking to the API over HTTP).

Posted

Welcome to the Serif Affinity forums.

Neither of those is possible in Publisher today. And no one can predict whether they'll be available in the future, nor when.

Your best alternative, I think, would be to write a program that read the CSV file and transformed it into a DOCX file with all the data (and, perhaps, the formatting) in place. Then you can Open the DOCX file in Publisher.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.5, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.4

Posted

Thanks Walt. I also just saw that Publisher apparently now supports IDML files. I've never worked with IDML before, but from a quick skim it sounds like it might work. Any thoughts on the pros and cons of IMDL vs. DOCX? Would either of those allow me to programmatically apply a style by name (e.g. "sectionhead"), and then have the specifics of that style defined in Publisher? I'm trying to avoid having to hardcode actual formatting in the program or intermediate file, and also to not have to manually go through 30 pages applying styles every time. The nice thing about my current setup is that I can instantly change anything about the layout just by updating the styles in the template.

Posted

IDML is a good idea if you'll continue to have InDesign available, but then, do you really need Publisher for this?

When you import (Open, or Place) either kind of file (IDML, DOCX), any styles in the text come along and are applied to the imported text. You will need to fix them afterwards, but you can do that using Find and Replace, where you can find all text with text style X and change it to text style Y.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.5, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.4

Posted

I probably just need to dig into it and try it to figure this out, but the thing I'm worried about is that some of my styles are very complex (not just bold, italic, font size, etc., but tweaks to kerning, hanging indents, before-and-after paragraph spacing, and so on). So I need a way to represent those without having to reapply it every time. I was thinking IDML might be better suited to carrying those through even if I don't keep InDesign (which I do currently have, but I've been considering getting rid of it because I don't use it that much so it's hard to justify the ongoing cost just for this one hobby project).

Posted
2 minutes ago, seanharding said:

So I need a way to represent those without having to reapply it every time.

The imported text will come with its own text styles applied, so you will need to re-apply yours unless you can setup the DOCX or IDML file to have all the appropriate text styles set ahead of time.

How many text styles do you have for this project? You'll need 1 Find/Replace per style if you need to override what comes in with something of your own.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
    Laptop 2: Windows 11 Pro 24H2,  16GB memory, Snapdragon(R) X Elite - X1E80100 - Qualcomm(R) Oryon(TM) 12 Core CPU 4.01 GHz, Qualcomm(R) Adreno(TM) X1-85 GPU
iPad:  iPad Pro M1, 12.9": iPadOS 18.5, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sequoia 15.4

Posted

IDML files are Indesign files that are able to work in older versions of Indesign and can be opened in  Publisher as well, though not always with a perfect conversion. So this is a page layout format, DOCX is a word processing format, completely different. 

Posted

I am wondering if you should consider another route.

Your data is really more appropriate as a relational database, not a flat file. And the report builder tools for database apps like MS Access and LibreOffice Base can easily group your data as desired. Import your CSV file into the database first.

With LibreOffice Base the report is output as a LibreOffice Writer file. That document can be edited for styles etc., and even saved as a .docx file, or PDF, or .rtf, etc.

Not sure how it works in MS Access. Think it only outputs to .rtf - and .docx output requires some VBA code.

Once placed into an APub doc the next style feature could be used to quickly style the whole doc if needed.

Posted

It's a fair point, but I'll say I'd rather stick with my current InDesign solution than get into Access and LibreOffice (if for no other reason than that I have no Windows computers and am not going to set one up for Access, and the LibreOffice UX was pretty bad last time I tried it). It's true that at its core the data is relational. In fact, the source of truth is a relational database. But it's a webapp I don't own, so I don't have direct access to the DB. I can get the data via API or CSV downloads. Going from the "real" database, through the API or export transformations, and then reconstituting it into some relational db, whether it be Access, mysql, or anything else, feels like a headache beyond what I want to deal with. 

Regarding docx vs. IDML, I view this as more of a page layout problem than a word processing problem, but maybe that's just the way my brain works. I want finer control of object positioning, typography, etc. than the typical word processor is really designed to provide (even if they try). I'm very experienced with InDesign, and before that Quark and PageMaker, so it's kind of my comfort zone. Really the only reason I'm looking to change is that these days I don't do as much of that kind of work, and the InDesign cost is starting to feel like a waste of money...

Anyway, thanks for the great input, everyone. This gave me some ideas to start experimenting with and see if it's worth diving fully into. 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.