luusluus / vscode-parquet-visualizer

vscode extension for SQL querying and visualizing parquet files
https://marketplace.visualstudio.com/items?itemName=lucien-martijn.parquet-visualizer
MIT License
5 stars 0 forks source link

Bug: Query View - Copy Page still includes some formatting #88

Open darrylthom opened 1 day ago

darrylthom commented 1 day ago

When I use Copy, and paste into Excel it looks like it is still including the following formatting options: -Bold -Wrap Text (this one especially ends up not looking great in Excel)

And I am not sure if it's possible, but let's say I have a String of "001000". When I paste this, Excel automatically changes it to a number 1000. I was not sure if it's possible to flag what is being copied to the clipboard as text explicitly so that it does not lose the leading the zeroes. I know this one is sort of an Excel issue since it's automatically casting to a whole number.

luusluus commented 22 hours ago

Maybe in excel the underling value is still "001000" but excel decides to logically present it as 1000? I'm not sure.

I'll take a look in the options on what's possible here.

Do you have an example parquet file that I can test this on?

luusluus commented 22 hours ago

Do you mean that text is wrapped like the following?

image

In this example I manually set wrap text to a cell. Initially it wasn't wrapped.

darrylthom commented 21 hours ago

Do you mean that text is wrapped like the following?

image

In this example I manually set wrap text to a cell. Initially it wasn't wrapped.

When I use Copy Page and paste directly into Excel, all of my cells pasted in have Wrap Text selected in the Home tab and the first row has Bold text. Also, the alignment is getting set as well but that might have to do with Excel's detected "type".

luusluus commented 21 hours ago

I've fixed the header being bold. I'm not sure if I've fixed the wrap text thing, as it didn't occur to me in google sheets (I don't have excel).

https://github.com/luusluus/vscode-parquet-visualizer/pull/90

darrylthom commented 21 hours ago

Maybe in excel the underling value is still "001000" but excel decides to logically present it as 1000? I'm not sure.

I'll take a look in the options on what's possible here.

Do you have an example parquet file that I can test this on?

number leading zeroes.zip

Here is an example of a field with leading zeroes. When I Copy Page and paste into Excel it gets rid of the leading zeroes.

luusluus commented 21 hours ago

Thanks for the example. Do you also have a parquet file where the wrapping text occurs in excel?

darrylthom commented 21 hours ago

Thanks for the example. Do you also have a parquet file where the wrapping text occurs in excel?

That one with the leading zeroes is doing the text wrapping in Excel as well.

darrylthom commented 21 hours ago

If it's copying the HTML into the clipboard, perhaps it is including some sort of formatting markets that Excel is interpreting and forcing it to wrap?

darrylthom commented 21 hours ago

Perhaps this could solve the leading zeroes getting messed up? Assuming you are copying an HTML table...

This would be for String columns: <td style="mso-number-format:\@;">

https://dev.to/anrodriguez/styling-excel-cells-with-mso-number-format-css-attribute-updated-j6i

white-space: nowrap; might address text wrapping, but not sure exactly what is causing it.

darrylthom commented 20 hours ago

For String in my previous post it got cut off, but this might fix the leading zeroes issues:

mso-number-format:"\@"