One of the most fundamental thing that any OpenOffice user will want to do is to print a document. This turorial shows exactly how to do this - automatically from a macro ![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512337382/cuileyzs2fimkp6hiiri.png) Anyone writing OpenOffice.org Basic Macros will need to print documents - automatically; and when they do that they might well expect to use a simple print statement. They, of course, won't be disappointed because that's exactly what they will find. Unfortunately life (and OpenOffice Basic) is never quite as simple as that (and if it was then this would be a very short article) ![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512337456/jerojlhuknoa2lzqsg40.png) <h3>Printing an OpenOffice Document from a Macro</h3> Printing an OpenOffice.org document from a macro is simple - as long as the print function is handled correctly - and that means supplying the correct parameters; so a macro to print a document would be: Sub PrintMe thisComponent.Print (Array ()) End Sub Anyone new to creating macros may wonder what this means, but it's quite simple: - thisComponent - the current document - Print - the print method for thisComponent - Array - this is just an empty array And the result of running this macro? The current document is sent directly to the default printer. ![image.png](https://res.cloudinary.com/hpiynhbhq/image/upload/v1512337627/liqvy9cuvxj3jjv9zwd9.png) <h3>Adding Printer Parameters to a Macro</h3> In the above example an empty array is passed to the document's print method, causing the document to be sent directly to the printer; and it won't take long for any macro developer to work out that this array is the means by which they can send parameters to the printer - parameters to modify the way in which the document is to be printed, such as: - the number of copies to be printed - which pages to print - a filename to send the document to (rather than a printer) - whether multiple documents are to be collated or not So then it's just a matter of knowing what the parameters are and how to add them to the array. <h3>Printing More Than One Copy of a Document</h3> The best way for a new user to understand how to add a printer parameter is to see an actual example, in this case how to print more than one copy: Sub PrintMe Dim PrintProperty(0) as New com.sun.star.beans.PropertyValue PrintProperty(0).Name = "CopyCount" PrintProperty(0).Value = 2 thisComponent.Print (PrintProperty) End Sub This time the code is used to: - define an array of data type PropertyValue - each element consisting of a "Name" and a "Value" - load the array with the parameters needed to print 2 copies of the document - pass the array to the Print method From this it's obvious how the parameters should be manipulated: - create an array to contain the parameters - load the array with the required parameters - feed the array containing the parameters to the method And all of this can be made clearer by looking at another example. <h3>Printing Defined Pages</h3> If more than one parameter is to be used then the size of the array must be increased accordingly: Dim PrintProperty(1) as New com.sun.star.beans.PropertyValue PrintProperty(0).Name = "CopyCount" PrintProperty(0).Value = 2 PrintProperty(1).Name = "Pages" PrintProperty(1).Value = "1;3-5;9" thisComponent.Print (PrintProperty) In this example, - the size of the array has been increased to 2 (0 and 1) - the additional parameter's name has been defined as Pages - the parameter's value has been set to "1;3-5;9" meaning that pages 1, 9 and 3 through to 5 will be printed <h3>Printing to a File</h3> The default when printing is to print to a printer (no surprise there then), however it is possible to print directly to a file: - set the name to "FileName" - set the value to the name of the file to use as an output <h3>Collating the Pages to be Printed</h3> If multiple copies need to be printed and collated then: - set the parameter name to "Collate" - set the value to True **Conclusion** The parameters available to OpenOffice.org's print method are not extensive, but that means that is very simple to use; and a user will find it easy to access its limited number of parameters: - Collate - CopyCount - Filename - Pages Most imporantly, a user is able to print an OpenOffice document automatically - just by running a simple macro. <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@dorodor/openoffice-macros-printing-a-document-how-to-print-openoffice-org-documents-by-using-a-macro">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
post_id | 19,395,705 | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
author | dorodor | ||||||||||||||||||||||||||||||||||||||||||||||||
permlink | openoffice-macros-printing-a-document-how-to-print-openoffice-org-documents-by-using-a-macro | ||||||||||||||||||||||||||||||||||||||||||||||||
category | utopian-io | ||||||||||||||||||||||||||||||||||||||||||||||||
json_metadata | "{"type": "tutorials", "repository": {"id": 14357669, "watchers": 170, "events_url": "https://api.github.com/repos/apache/openoffice/events", "forks": 117, "name": "openoffice", "issues_url": "https://api.github.com/repos/apache/openoffice/issues{/number}", "trees_url": "https://api.github.com/repos/apache/openoffice/git/trees{/sha}", "fork": false, "git_url": "git://github.com/apache/openoffice.git", "assignees_url": "https://api.github.com/repos/apache/openoffice/assignees{/user}", "size": 1578010, "owner": {"id": 47359, "following_url": "https://api.github.com/users/apache/following{/other_user}", "starred_url": "https://api.github.com/users/apache/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/apache/subscriptions", "repos_url": "https://api.github.com/users/apache/repos", "login": "apache", "gists_url": "https://api.github.com/users/apache/gists{/gist_id}", "followers_url": "https://api.github.com/users/apache/followers", "received_events_url": "https://api.github.com/users/apache/received_events", "type": "Organization", "avatar_url": "https://avatars0.githubusercontent.com/u/47359?v=4", "site_admin": false, "organizations_url": "https://api.github.com/users/apache/orgs", "gravatar_id": "", "events_url": "https://api.github.com/users/apache/events{/privacy}", "url": "https://api.github.com/users/apache", "html_url": "https://github.com/apache"}, "forks_count": 117, "git_refs_url": "https://api.github.com/repos/apache/openoffice/git/refs{/sha}", "blobs_url": "https://api.github.com/repos/apache/openoffice/git/blobs{/sha}", "pushed_at": "2017-12-02T23:20:47Z", "watchers_count": 170, "teams_url": "https://api.github.com/repos/apache/openoffice/teams", "comments_url": "https://api.github.com/repos/apache/openoffice/comments{/number}", "archived": false, "svn_url": "https://github.com/apache/openoffice", "merges_url": "https://api.github.com/repos/apache/openoffice/merges", "subscribers_url": "https://api.github.com/repos/apache/openoffice/subscribers", "issue_events_url": "https://api.github.com/repos/apache/openoffice/issues/events{/number}", "stargazers_url": "https://api.github.com/repos/apache/openoffice/stargazers", "mirror_url": null, "statuses_url": "https://api.github.com/repos/apache/openoffice/statuses/{sha}", "has_projects": true, "milestones_url": "https://api.github.com/repos/apache/openoffice/milestones{/number}", "description": "Mirror of Apache OpenOffice", "keys_url": "https://api.github.com/repos/apache/openoffice/keys{/key_id}", "open_issues": 3, "compare_url": "https://api.github.com/repos/apache/openoffice/compare/{base}...{head}", "ssh_url": "git@github.com:apache/openoffice.git", "license": null, "html_url": "https://github.com/apache/openoffice", "commits_url": "https://api.github.com/repos/apache/openoffice/commits{/sha}", "open_issues_count": 3, "stargazers_count": 170, "branches_url": "https://api.github.com/repos/apache/openoffice/branches{/branch}", "full_name": "apache/openoffice", "forks_url": "https://api.github.com/repos/apache/openoffice/forks", "score": 108.60847, "deployments_url": "https://api.github.com/repos/apache/openoffice/deployments", "contributors_url": "https://api.github.com/repos/apache/openoffice/contributors", "homepage": null, "contents_url": "https://api.github.com/repos/apache/openoffice/contents/{+path}", "has_downloads": true, "collaborators_url": "https://api.github.com/repos/apache/openoffice/collaborators{/collaborator}", "created_at": "2013-11-13T08:00:13Z", "git_commits_url": "https://api.github.com/repos/apache/openoffice/git/commits{/sha}", "releases_url": "https://api.github.com/repos/apache/openoffice/releases{/id}", "private": false, "pulls_url": "https://api.github.com/repos/apache/openoffice/pulls{/number}", "git_tags_url": "https://api.github.com/repos/apache/openoffice/git/tags{/sha}", "notifications_url": "https://api.github.com/repos/apache/openoffice/notifications{?since,all,participating}", "language": "C++", "updated_at": "2017-11-28T12:31:56Z", "has_wiki": false, "downloads_url": "https://api.github.com/repos/apache/openoffice/downloads", "hooks_url": "https://api.github.com/repos/apache/openoffice/hooks", "languages_url": "https://api.github.com/repos/apache/openoffice/languages", "default_branch": "trunk", "labels_url": "https://api.github.com/repos/apache/openoffice/labels{/name}", "url": "https://api.github.com/repos/apache/openoffice", "has_pages": false, "tags_url": "https://api.github.com/repos/apache/openoffice/tags", "clone_url": "https://github.com/apache/openoffice.git", "archive_url": "https://api.github.com/repos/apache/openoffice/{archive_format}{/ref}", "has_issues": false, "issue_comment_url": "https://api.github.com/repos/apache/openoffice/issues/comments{/number}", "subscription_url": "https://api.github.com/repos/apache/openoffice/subscription"}, "pullRequests": [], "format": "markdown", "image": ["https://res.cloudinary.com/hpiynhbhq/image/upload/v1512337382/cuileyzs2fimkp6hiiri.png"], "links": ["https://res.cloudinary.com/hpiynhbhq/image/upload/v1512337382/cuileyzs2fimkp6hiiri.png", "https://res.cloudinary.com/hpiynhbhq/image/upload/v1512337456/jerojlhuknoa2lzqsg40.png", "https://res.cloudinary.com/hpiynhbhq/image/upload/v1512337627/liqvy9cuvxj3jjv9zwd9.png"], "app": "utopian/1.0.0", "platform": "github", "tags": ["utopian-io", "openoffice", "opensource"], "community": "utopian"}" | ||||||||||||||||||||||||||||||||||||||||||||||||
created | 2017-12-03 21:47:54 | ||||||||||||||||||||||||||||||||||||||||||||||||
last_update | 2017-12-03 21:47:54 | ||||||||||||||||||||||||||||||||||||||||||||||||
depth | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
children | 2 | ||||||||||||||||||||||||||||||||||||||||||||||||
net_rshares | 12,336,419,922,197 | ||||||||||||||||||||||||||||||||||||||||||||||||
last_payout | 2017-12-10 21:47:54 | ||||||||||||||||||||||||||||||||||||||||||||||||
cashout_time | 1969-12-31 23:59:59 | ||||||||||||||||||||||||||||||||||||||||||||||||
total_payout_value | 29.590 SBD | ||||||||||||||||||||||||||||||||||||||||||||||||
curator_payout_value | 11.452 SBD | ||||||||||||||||||||||||||||||||||||||||||||||||
pending_payout_value | 0.000 SBD | ||||||||||||||||||||||||||||||||||||||||||||||||
promoted | 0.000 SBD | ||||||||||||||||||||||||||||||||||||||||||||||||
body_length | 4,690 | ||||||||||||||||||||||||||||||||||||||||||||||||
author_reputation | 4,387,551,450,260 | ||||||||||||||||||||||||||||||||||||||||||||||||
root_title | "OpenOffice Macros: Printing a Document How to Print OpenOffice.org Documents by Using a Macro " | ||||||||||||||||||||||||||||||||||||||||||||||||
beneficiaries |
| ||||||||||||||||||||||||||||||||||||||||||||||||
max_accepted_payout | 1,000,000.000 SBD | ||||||||||||||||||||||||||||||||||||||||||||||||
percent_steem_dollars | 10,000 | ||||||||||||||||||||||||||||||||||||||||||||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
walnut1 | 0 | 2,645,044,909 | 6% | ||
droucil | 0 | 63,815,700,932 | 50% | ||
cifer | 0 | 2,453,560,004 | 100% | ||
utopian-io | 0 | 12,263,167,850,305 | 8% | ||
reyha | 0 | 3,296,349,178 | 50% | ||
coptamystic | 0 | 50,561,229 | 25% | ||
olivaw | 0 | 990,855,640 | 100% |
Thank you for the contribution. It has been approved. You can contact us on [Discord](https://discord.gg/UCvqCsx). **[[utopian-moderator]](https://utopian.io/moderators)**
post_id | 19,457,830 |
---|---|
author | arie.steem |
permlink | re-dorodor-openoffice-macros-printing-a-document-how-to-print-openoffice-org-documents-by-using-a-macro-20171204t161105085z |
category | utopian-io |
json_metadata | "{"app": "busy/1.0.0", "community": "busy", "tags": ["utopian-io"]}" |
created | 2017-12-04 16:11:09 |
last_update | 2017-12-04 16:11:09 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2017-12-11 16:11:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 172 |
author_reputation | 133,864,884,206,999 |
root_title | "OpenOffice Macros: Printing a Document How to Print OpenOffice.org Documents by Using a Macro " |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |
### Hey @dorodor I am @utopian-io. I have just upvoted you! #### Achievements - You have less than 500 followers. Just gave you a gift to help you succeed! - Seems like you contribute quite often. AMAZING! #### Community-Driven Witness! I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER! - <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a> - <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a> - Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a> [![mooncryption-utopian-witness-gif](https://steemitimages.com/DQmYPUuQRptAqNBCQRwQjKWAqWU3zJkL3RXVUtEKVury8up/mooncryption-s-utopian-io-witness-gif.gif)](https://steemit.com/~witnesses) **Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
post_id | 19,550,548 |
---|---|
author | utopian-io |
permlink | re-dorodor-openoffice-macros-printing-a-document-how-to-print-openoffice-org-documents-by-using-a-macro-20171205t171406383z |
category | utopian-io |
json_metadata | "{"app": "utopian/1.0.0", "community": "utopian", "tags": ["utopian-io"]}" |
created | 2017-12-05 17:14:06 |
last_update | 2017-12-05 17:14:06 |
depth | 1 |
children | 0 |
net_rshares | 0 |
last_payout | 2017-12-12 17:14:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 SBD |
curator_payout_value | 0.000 SBD |
pending_payout_value | 0.000 SBD |
promoted | 0.000 SBD |
body_length | 1,083 |
author_reputation | 152,913,012,544,965 |
root_title | "OpenOffice Macros: Printing a Document How to Print OpenOffice.org Documents by Using a Macro " |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 SBD |
percent_steem_dollars | 10,000 |