timotejs Posted August 31, 2019 Share Posted August 31, 2019 (edited) Dear Affinity/Serif, I am longer time owner of Affinity Photo and Designer and now I bought Publisher as well to try it out. However I found an problem which currently makes it difficult to me to move to it. Description: I have a bible with all the verses in database. With my current software I created small program which automatically marks everything: Chapter name with "Chapter" paragraph style, marks verse numbering as subscript, adds tab between subscript number and actual verse text, book names as "Book name" paragraph style. Therefore I am able to import entire text automatically (without manually going to every single verse and one by one doing it myself). I opened the file generated from publisher in editor and I see it is binary format... therefore i do not know how to add text to it myself. Is there any feature which allows me to programmatically add big texts? If so how? I am able to modify my generator to produce any output as needed. But i do not know currently any way to do it. Is there some text import format? Example: assuming affinity-document-style-chapter and affinity-document-style-01 are already created in my affinity document. Can i import something like: <p style="affinity-document-style-chapter">Chapter name 1</p> <p style="affinity-document-style-01"><subsript>1.</subscript>test of the verse</p> ... Thank you for help and hopefully you can understand what i mean (as english is not my native language). Edited August 31, 2019 by timotejs Quote Link to comment Share on other sites More sharing options...
MikeW Posted August 31, 2019 Share Posted August 31, 2019 If I am understanding properly, no. APub accepts plain text (as in zero styling with no tags), RTF and DOCX. Your generated text with tags is akin to what would be used by QuarkXPress, InDesign, and the long-gone Ventura Publisher & Pagemaker, etc. For any of those applications the generated text tags would need some modification, but as you are able to do so, it's not much effort. There is a way to bring the plain text you have into APub and, using GREP find/replace, do the styling. But if that's what you end up doing, I would recommend simplifying your tags to make the GREP expressions simpler. timotejs 1 Quote Link to comment Share on other sites More sharing options...
timotejs Posted August 31, 2019 Author Share Posted August 31, 2019 (edited) Well what i need is a way to import text with some formatting.... subscript, styles for paragraph so i do not have to go trough entire book and apply manually. as per format i can modify my data as needed (i can program) the XMLlike thing in my original post is just an sample Edited August 31, 2019 by timotejs Quote Link to comment Share on other sites More sharing options...
MikeW Posted August 31, 2019 Share Posted August 31, 2019 It's not going to happen in APub at this time unless you can export to RTF. In QXP, the paragraph style tags are simple, @Chp: Character styles are simply a tag enclosed in angle brackets with a symbol, code or named character styles. A superscript is <+>7<$>. The first tag is the superscript, the number/text to be super-scripted, followed by a dollar sign in angle bracets to return to the paragraph style in use. But if you need/want to use APub for formatting, you will need to do what I wrote at the end of my last post. Simplify the tags. Do a GREP search for the start/end tags and the text between. Capture the text between the tags, use that captured text in the replace and set the paragraph style, the character style or simple text attributes all at once. Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted August 31, 2019 Share Posted August 31, 2019 1 hour ago, MikeW said: It's not going to happen in APub at this time unless you can export to RTF. Exporting to .docx is probably better than exporting to .rtf, as the .docx importer in Publisher is newer than the .rtf importer and (from discussions I recall) supports more features. Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. iPad: iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1 Link to comment Share on other sites More sharing options...
Wosven Posted August 31, 2019 Share Posted August 31, 2019 1 hour ago, walt.farrell said: Exporting to .docx is probably better than exporting to .rtf Yes, and it's better with references for notes if you need to keep them (they disappear with RTF import). This way, you'll import the styles, (if you already created them in APub, APub will import them again and appends a number, it can be annoying. You'll need to search/replace each Word style by the correct APub one). If you import them in a document with no styles, you'll have to check and correct them, since not all is implemented. You can do some tests with smaller books than the Bible, since without scripting and some bugs,such text will be a real challenge. Quote Link to comment Share on other sites More sharing options...
MikeW Posted August 31, 2019 Share Posted August 31, 2019 2 hours ago, walt.farrell said: Exporting to .docx is probably better than exporting to .rtf, as the .docx importer in Publisher is newer than the .rtf importer and (from discussions I recall) supports more features. I mentioned rtf as it is documented and easier to write beginning with what sounds like is a plain text database. Really, if a text export to anything other than marked up text isn't possible, I would just use Q. There are other reasons to not use APub too, especially with such a document. Quote Link to comment Share on other sites More sharing options...
walt.farrell Posted August 31, 2019 Share Posted August 31, 2019 34 minutes ago, MikeW said: I mentioned rtf as it is documented and easier to write Having never tried to write either, I'm not sure whether rtf or docx would be easier. Both are documented. Edit: However, as docx is an XML-based format, I would suspect it's easier. Quote -- Walt Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases PC: Desktop: Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 Laptop: Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU. iPad: iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard Mac: 2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1 Link to comment Share on other sites More sharing options...
MikeW Posted August 31, 2019 Share Posted August 31, 2019 39 minutes ago, walt.farrell said: Having never tried to write either, I'm not sure whether rtf or docx would be easier. Both are documented. Edit: However, as docx is an XML-based format, I would suspect it's easier. RTF is reasonably simple. XML, at least so it conforms to Word XML, is not. And as one would need to conform to Word's XML (maybe ODT's too?) as well as the other garbage that makes up a Word XML all zipped up properly, I would pick RTF over it. But then, I don't have to choose between those two formats. walt.farrell 1 Quote Link to comment Share on other sites More sharing options...
MikeW Posted September 1, 2019 Share Posted September 1, 2019 Just for fun, I took 10 French Bible versus and output a minimal RTF and opened it in Word in order to save and extract its XML text. This is why would use RTF. Both are basically text files. And the nice thing about Word XML, the only thing about Word XML, is that it is Unicode-compliant. RTF is stuck in the 7-bit world. So if, like my example, one is not outputting plain ASCII, then each otherwise Unicode character needs a translation to a code, which you can see if the RTF is opened in a text editor. One can build the translation table reasonably easy, but the also exist in OpenSource projects, though I didn't look into that much. Mike Desktop.7z walt.farrell 1 Quote Link to comment Share on other sites More sharing options...
timotejs Posted September 1, 2019 Author Share Posted September 1, 2019 (edited) Hmmm I am investigating the Search and replace route. And so far it seems to be working. It even supports RegEx in what by trial/error seems to be Ruby like syntax. Therefore I can export my text with my own tags e.g. "<make_this_book_paragraph_style>Name of Book<\>" and then search with RegEx In Find text box (the cog wheel icon has RegEx option in the drop down): <make_this_book_paragraph_style>(.+)<\\> Then in 'replace with': $1 and in cog wheel for 'replace with' there is option to apply style..... That correctly applies style and removes my custom tags :) (as i mentioned i can format my text as i want as i have it in database and I can program) I will play with it a bit further but it seems I can use Affinity indeed with semi-automatic text import By another words... Thanks to nice regex support in Find And Replace I can basically create my own "format" for import Hopefully i will not hit some dead end as i would love to move all my workflow to Affinity Edited September 1, 2019 by timotejs clarity Wosven and MikeW 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.