Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cwStyle causes an Excel repair #75

Closed
stla opened this issue Jan 16, 2017 · 10 comments
Closed

cwStyle causes an Excel repair #75

stla opened this issue Jan 16, 2017 · 10 comments
Labels

Comments

@stla
Copy link
Contributor

stla commented Jan 16, 2017

Hello,

I tried to set column widths. The field cwStyle is mandatory. I don't know what it refers to. I set it to 1, so that I got

	<cols>
		<col max="4" min="1" style="1" width="30"/>
	</cols>

in my sheet1.xml. Excel does not like that, it has to repair the file:

Repaired Records: Column information from /xl/worksheets/sheet1.xml part

I took a look at the repaired file. Excel did several modifications but the important one is that it removed the style="1". Indeed, if I remove it:

	<cols>
		<col max="4" min="1" width="30"/>
	</cols>

then Excel opens the file without issue.

@qrilka
Copy link
Owner

qrilka commented Jan 17, 2017

Thanks for reporting - I'll look into it later today

@qrilka qrilka added the bug label Jan 17, 2017
@qrilka
Copy link
Owner

qrilka commented Jan 17, 2017

@stla it appears to be a bug as style is optional having default value of 0. Spec says only

Default style for the affected column(s). Affects cells not yet allocated in the column(s).
In other words, this style applies to new columns.
The possible values for this attribute are defined by the W3C XML Schema unsignedInt
datatype.

I.e. they don't say directly that it's the same "pointer" into cellXfs as for cells but I suppose it is so.
And also this default of 0 could be some kind of explanation for #73

@qrilka
Copy link
Owner

qrilka commented Jan 17, 2017

@stla please let me know if f607a6f looks enough to close this issue

@stla
Copy link
Contributor Author

stla commented Jan 17, 2017

So, without using your update, I tried and I confirm it works with:

ColumnsWidth {cwMin = 1,
                          cwMax = 4,
                          cwWidth = 30,
                          cwStyle = 0}

(previously I set cwStyle=1).

What is your update supposed to do ? To fix if cwstyle is mispecified ?

@stla
Copy link
Contributor Author

stla commented Jan 17, 2017

I tried your new version. With cwStyle=1 there's the same problem. But I probably misunderstood what I'm supposed to try.

@qrilka
Copy link
Owner

qrilka commented Jan 18, 2017

With the update you shouldn't be able to set cwStyle=1 as the field type now is Maybe Int.
I.e. the update was about being able to set it to Nothing. From the other side as I understand it should work with cwStyle=Just 1 if you'll add new cellXf record (which should get id 1)

@stla
Copy link
Contributor Author

stla commented Jan 18, 2017

Are you sure ? I'll look later, but I'm pretty sure that I had cwStyle :: Int yesterday. I have your update since there is now a field AutoFilter in Worksheet.

@qrilka
Copy link
Owner

qrilka commented Jan 18, 2017

I've referenced incorrect commit but 61e41a9#diff-47e033d4407f05d43c094884d7c4194fR145 shows what I had in mind:

  , cwStyle :: Maybe Int

@stla
Copy link
Contributor Author

stla commented Jan 18, 2017

I do that but stack does not update:

- location:
   git: https://github.com/qrilka/xlsx.git
   commit: 61e41a9e6a14324a7a0c2e123789631e3f39381a

I don't understand. This is the way I used yesterday.

@stla
Copy link
Contributor Author

stla commented Jan 18, 2017

Ok, I've used git clone and I replaced the previous download. It works with cwStyle = Nothing. Thank you !

@qrilka qrilka closed this as completed Jan 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants