Adding custom caption type to .ott then auto-inheritance to .odt

Version: 25.2.7.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 2; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.utf8); UI: en-US
25.2.7-4
Calc: threaded

Working with .ott and a series of derivative .odt. Style-based writing however mainly paragraph and character, page styles. Other categories of styles rather avoided due to their proprietary nature.

Recently I added custom caption category. I handled for achieving this goal in Menu Insert > Fields > More Fields… > the tab Variables. In Frame Type the “Number Range” selected, then in field Name the name of new caption category typed. Closing dialog. Inserting a field of this category to template document. Then going to one .odt, reloading it. Unfortunately the new variable is not listed in frame Select.

Tried to use Writer Guide, and LO-Help for support but no success on finding hints.

What works very well so far is the use of Figure captions using the Writer-stock variable Figure. I am still in the phase of placing captions in content flow of document. One day in future I will want to add index of these captions to document, like a number of other indices (e.g. figures). Any hints.

I believe to had already used custom captions in the past however nowadays no luck on finding help material how to proceed.

EDIT
I practice manual creation of captions (based of one recommendation got from @ajlittoz once in the past). Procedure looks like this. Create a paragraph below document content element to be captioned, type the string according to caption line pattern (caption header, caption number, caption body). Use field of custom variable for caption numbering (see this question objectives).

I created a template containing a custom number range and saved it as a template.

When I File>New>Templates with my saved template, the Untitled.odt has the number range. Insert>Caption can use the number range. You can also create the caption directly with the custom number range without using Insert>Caption (and thus avoid creating a frame around a picture).

If you can’t, either you didn’t save really as a template or something went wrong during number range creation.

How does the existence of number range (also custom number range) manifest in template and in derivative document?
My current writing doesn’t use automatic captions, nor it uses Add Caption feature of Writer. Creating captions is performed as described in question’s update paragraph - manually.

I see however there may be some culprit in my captioning: A sequence of short paragraphs (paragraphs of the length no more than two lines each) is considered to be a logical block of text (in document / on a page) and the intention is to have each occurrence of a block this kind to be captioned >>> I in this particular case I am not captioning object, nor table, no diagram, no figure, etc. but a sequence of short paragraphs gets captioned. It is like section “Adding captions manually” in Writer Guide, chapter 11, WG7.6. The only difference is that captioning of these blocks of paragraphs doesn’t use number range Figure but a custom one. The number range named Figure is used to caption diagrams in document. Custom number range definitely exists, is visible and can be used in .ott. However it is not available in .odt for field insertion to document.

Of course document comprises also diagrams or figures, tables which get also a caption each <<< this is however no objective of this question asked.

I see, I need to consult Writer Guide section “Defining your own numbering sequences”.

CURRENT Status
Custom numbering sequences created in .ott definitely do not propagate to .odt based on that template. However reloading .odt (menu File) results in the prompt asking user if styles should be updated according to recent modification in document template.

EDIT
deepwiki Devin finds out that the process of Styles loading doesn’t synchronize variable field definitions (numbering ranges). Latter ones were stored separately to styles. Myself would need to recreate numbering sequence in document via same procedure as it was performed the template level. Or, alternatively to copy field instance from template to document one time. I will try it out.

Reduce a copy of your .odt to 1 page and redact any confidential data. Attach it to comment. I’ll have a look to see if it is linked to a template.

Thanks for your offer. Please give me some time. In the meantime following observations regarding the link to template. I can see in document properties the template to be linked. Furthermore after Headline 1 paragraph style in template got modified by myself in remarkable way (for test) then reloading document and accepting styles leads to the effect that modification be present also in document. Writer prompts me to accept styles update or refrain from doing that each time template receives modifications in document body and style definitions.

EDIT
I examine also .odt saved to .fodt and can find in .fodt numbering range myself created in template be present in .fodt structure office:body > office:text > text:sequence-decls > 7 "entry of my numbering sequence. Entry has three attributes. Attribute text:name presents the string myself assigned to name of numbering range that point of time I was creating custom numbering range in used document template.

Weeks/months ago the group of .ott and .odt was created and is in use up to now. Template got registered to Writer as of that day.

Then your document is linked to a template. No need to send for this check.

I made an experiment where I create a template, base a document on it and close my session. I then modify the template, adding a number range. I can force reload of styles in the document but, effectively, the number range does not show up.

IMHO, since a number range is not a style, it is probably considered as contents. This contents is only copied when the document is created from the template (initial editing session) and never later. Updating contents could create data loss and thus this is forbidden.

Authorising wider “internal dictionary” update could be a nice enhancement. If you feel you can make a “good” specification and argument it, don’t hesitate to submit a feature request on Bugzilla. But don’t expect too much: there are so many important pending bugs that “comfort” enhancements are second priority.

Possible you kindly look also at my last update?

Additionally I would need to find free time window, that may be hard as well. Hence, actually I can put this question to state got-answered. Deepwiki Devin communicated the same nature of root-cause after its code base analysis.

You’re welcome.

I believe to had used custom numbering range successfully 3 or 2 years ago.

Maybe you created the custom numbering, with the number format, selected the field and added it to AutoText. The custom numbering is then available to all documents and will add the custom Number Range to any document into which it is introduced by typing the shortcut and pressing F3.

I decided to use method described below to recover the link document to template in terms of custom number range inheritance (deepwiki Devin found that this inheritance is implemented by Writer handling separate to styles inheritance handling). Recovery method presented results in document be able to access and use custom number range created in template.

  • Create a copy of document, do it by Writer-own means: menu File > Save a Copy…
  • Optionally create one further copy of .odt by means owned by operating system level file explorer
  • Create new blank document based on registered document template
  • Save to file name of former document; former working replica
  • Do copy& paste from former document copy to document created newly
  • custom number range managed on template level is available and ready now for use in document recovered replica.
    deepwiki Devin on LibreOffice-core code base proposed above recovery method.