question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Numbering in the format of [000X] with leading zeros

See original GitHub issue

I am trying to build a numbering format that uses up to three leading zeros, which is possible in the Word GUI.

I have gotten close with this format:

	{
      reference: 'numbering',
      levels: [
        {
          level: 0,
          format: 'decimalZero',
          text: '[00%1]',
          alignment: AlignmentType.LEFT,
          suffix: LevelSuffix.NOTHING
        }
      ]
    }

But it fails at 100+ going to [00100] rather than [0100]

I found in the spec that it says there is a format attribute that:

Specifies a custom format using the XSLT format attribute. For example, a value of &#x30A2 indicates that Katakana numbering should be used.

Does docx allow for custom formats? Is there another method that I’m missing?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
f3vecommented, Oct 21, 2021

Exactly. Thanks so much for your help though! I appreciate you reaching out 😄

1reaction
HTrayfordcommented, Oct 21, 2021

Yeah, I think you’re right. That makes a lot of sense. Basically you’re passing ‘000%1’ in and then the %1 is being replaced with the current number.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using a custom number format to display leading zeros
When you want to display leading zeros for a fixed-length number, create a custom format with the same number of zeros (0) as...
Read more >
2 Ways to Format a Number with Leading Zeros in Oracle
When using the TO_CHAR(number) function, use the 0 format element to include leading and/or trailing zeros. Example: SELECT TO_CHAR(7, 'fm000') ...
Read more >
Left zero padded format numbers - java - Stack Overflow
Show activity on this post. I want to format 4-digit numbers with left padded zeros and 5-digit numbers with no leading zeros so...
Read more >
Excel Format Numbers: How to turn "1" into "001" or "EN001"
In many instances, we would have to work with ID numbers that by nature need to have a few leading zeros before the...
Read more >
How to Format Numbers with Leading Zeros in Excel [Tutorial]
How to Format Numbers with Leading Zeros in Excel. Leading zeros are those pesky place-holding 0 digits at the beginning of a number....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found