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.

Table name not protected against spaces

See original GitHub issue

Read and complete the full issue template

Do not randomly delete sections. They are here for a reason.

Do you want to request a feature or report a bug?

  • Bug
  • Feature
  • Question

Did you test against the latest CI build?

  • Yes
  • No

If you answered No, please test with the latest development build first.

Version of ClosedXML

0.97.0

What is the current behavior?

Allows empty space in table names image

What is the expected behavior or new feature?

When you give a name to a table the code protect against starting with number or repeated names, but don’t protected against space The expected behavior is to give an error

image

Is this a regression from the previous version?

I don’t know is my first attempt to use the library

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jahavcommented, Mar 23, 2023

@NickNack2020

I think it would be better to reject invalid name with an exception. Name of a table is not just an identifier, but it can also be used formulas structured references (e.g. SUM(SalesTable[Profit])).

I am in favour of simple, understandable interfaces and contracts and principle of least surprise. Having a name sanitizer inside is not in line with that.

I would therefore refuse any invalid table names. We already throw an exception There is already a table names 'Xyz' when if someone tries to add a table with duplicate name. This only enhances the contract to be correct.

Please add a note/mitigation about change to the https://github.com/ClosedXML/ClosedXML/blob/develop/docs/migrations/migrate-to-0.101.rst + info in XML doc.

Spec says

A string representing the name of the table. This is the name that shall be used in formula references, and displayed in the UI to the spreadsheet user. This name shall not have any spaces in it, and it shall be unique amongst all other displayNames and definedNames in the workbook. The character lengths and restrictions are the same as for definedNames. See SpreadsheetML Reference - Workbook definedNames section for details

0reactions
ruirodrigues1971commented, Mar 23, 2023

In the scenario that I was using was important that the name is correct. External System —> table names with spaces ----> closedXML Changing table names inside closedXML is a very dangerous solution in my opinion… The probability to think in every scenarios that the bad name (with spaces) can be used in the code can be huge…

I think the throwing error is the most correct. Is important the code has a coherent answer to dev errors. But this is my opinion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Worst Practice - Spaces in Object Names
We should "never" put spaces in object names, whether those objects are tables or fields. One reason is this 'Object Name' (one space)...
Read more >
sql - Pros and Cons of table name having spaces
Spaces in the tables names on the other hand add no value whatsoever. Mr. Anderson points out that its tedious. This is true...
Read more >
Anyone ever see SQL with spaces in the table names?
This has been well covered but here's a summary: Yes, we have seen SQL with space in table names. No, this is NOT...
Read more >
How to write SQL queries with spaces in column names
In this article, we are going to learn how we can write a SQL query with space in the column name. Blanks spaces...
Read more >
The space between the table and its caption is very small
if the captions are placed in the "opposite" position (below tables or above figures), no intervening space is provided. so identifying the ...
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