How to recreate page references in LibreOffice - reference

Before you dismiss this post as using LibreOffice documents THE WRONG WAY, let me explain what I'm trying to achieve. I am generating programatically ODT documents, which is mostly no big deal. I have hit the wall, however, trying to insert internal references into the documnt. It's quite simple to include an anchor in the content.xml with:
<text:reference-mark text:name="anchor"/>
inside <text:p> element. But when you want to reference it later LibreOffice inserts a reference with the page number. Obviously I don't know the page number where the anchor is, but I can easily include a reference to the anchor with
<text:reference-ref text:reference-format="page" text:ref-name="anchor"/>
The question is how to make LibreOffice recreate and insert page number on reading the document?

It turns out that LibreOffice does recreate page numbers provided there is actually any number included as contents of text:reference-ref
<text:reference-ref text:reference-format="page" text:ref-name="anchor">1</text:reference-ref>
When opened, upon a change of the file the page number is updated by LibreOffice.

Related

Get content from several Pages and Sections from OneNote to Excel

I am very new to all of this so please bare with me.
I have a OneNote Notebook with several Sections each containing hundreds of pages.
I need to retrieve all the content of the pages (while keeping the structure of the page titles / section titles) and end up with that content in a somewhat usable state in Excel. Of course, doing so manually will take me weeks. That's why I'm looking for an automated/semi-automated approach.
Is there a way to do that? What do I need to look into? I haven't found an answer on the interned but I guess I may need to use the OneNote API? Maybe find a way to export the OneNote content into .csv to then process it in Excel? Maybe the OneNote content can be retrieved directly by a macro in Excel?
What would you look into to achieve my goal?
Thank you for reading.
The OneNote API/Graph API can get sections and pages
GET https://graph.microsoft.com/v1.0/me/onenote/notebooks/{id}/sections
GET https://graph.microsoft.com/v1.0/me/onenote/sections/{id}/pages$count=true&$top=100
There may be a limitation to the number of pages that can be accessed by the API (recently introduced?). Then a further call to get individual page content:
GET https://graph.microsoft.com/v1.0/me/onenote/pages/{id}/content[?includeIDs=true]
An alternative may be to use this rust OneNote notebook parser - creates html files.

Add Bookmarks to pdf using Pymupdf

How to add Bookmarks to pdf using Pymupdf. I have seen many ways using PyPDF2 but since I'm already using pymupdf for other annotations I would prefer pymupdf for adding bookmarks. Also would like to highlight the text and add bookmarks to it.
You cannot add single bookmarks like you can in other packages.
If you have looked at the details there - or rather in the respective PDF specification, this is an overly / unnecessarily complex task.
PyMuPDF in contrast has this simple approach to offer:
Prepare a Python list that looks like a traditional table of contents (TOC):
Every line in the list contains the hierarchy level, the text to display and the page number. Optionally also some information where on the target page the pointer goes to.
Then use doc.set_toc(toc_list). All pesky detail is taken care of for you.
If the PDF already has a TOC, extract it to a list of that same structure via toc_list = doc.get_toc().
Then modify as required.

How to duplicate page in a DOCX file with python

I am using python-docx-template and python-docx to create DOCX file with one page. I need to duplicate the page in the document nth times. How can I do this with python?
python-docx doesn't have pages. However, it recognizes sections, so before you load the document with python-docx, make sure you insert section breaks before and after your target page.
However, currently, python-docx doesn't have APIs for grabbing the content of a section. If you really want it, you will have to walk through its underlying XML. You may start looking at it from document.__body, by print(document.__body).
You are basically looking for the contents between w:sectPr. See its documentation here:
https://python-docx.readthedocs.io/en/latest/dev/analysis/features/sections.html

DataTables export to excel

I'm currently working on a project (developed using laravel, php, javascript, jquery, html), containing a large amount of data, so I'm using DataTables to display them with serverside set to true. What I'm trying to figure out is how to export the complete table to an excel file - right now it only saves one page (the one being shown at that very moment ) - using the Button extention.
I've been reading about it for a while now but still can't figure out a way to do this. I understand that, since serverside is set to true,
the only rows that exist on the client-side are those shown in the table at any one time.
But how can I get the complete table? Any help would be appreciated!
UPDATE:
So I create the excel file with the data I want in the backend, using PHPExcel, but now the problem is that it is saved server-side, while I wanna make it downloadable (client-side). From what I've been reading, I must add the appropriate headers to do so, but nothing I've tried works. Using
this, I managed to output the data of the excel in the screen, but it just shows gibberish... I should probably also mention that I'm new at this!

How do I search attached files stored in a MS Access 2010 database?

How do I search in MS Access (ver 2010) for data in files attached to records? If I do a "Find" and specify text I KNOW is in an attached txt file to a particular record, there are no hits. While if I have the same data in a Text Field or Memo field, Access finds it. I understood from one of the Access help screens I found that it is possible to search attachments from within Access, but I have not been able to do this yet.
BTW, I did try using the query tool and searching for text I knew was in the attachment, but it was not successful, although it did find the same text within a memo field in another record.
Thx,
jmb
I'm fairly certain that there is no mechanism in Access to find records based on text within a file attachment. A bit of web searching found an earlier question here and the responses seem to agree that there isn't.
One reference from Microsoft here says
By using attachments, you open documents and other non-image files in their parent programs, so from within Access, you can search and edit those files.
but I think that statement could be misinterpreted. I believe what they meant to say was that
"...from within Access you can open an attachment in its parent program and then work on it as usual (e.g., edit it, search it, print it, and so on)."
You can use file system object, open the file as string and search sequentially. That's as close as you'll get

Resources