I have a specific problem with ClosedXML. In code, when I get the value of a cell in clasic way via Cell(x,y).Value I get a value "3.805", as string.
Problem is, that in excel file, this cell is formatted as "Text" and the value seen by user is "3,805", with comma, not with dot.
This problem occurred, when a user wanted to replace dot with comma in excel file with search and replace feature, and changed all dots in column for commas. These commas are visible for user in cells, but code reads them as dots. After manually changing the dots for commas in excel, code reads them with commas, as it should be.
Has someone experienced this behavior? Text value in excel appears with commas, when formatted as text and code with closedxml reads them as string with dots?
Related
I am working on a report that outputs an excel file. It has 7 tabs/worksheets that the user can choose between. I got the first 5 to format correctly.
But for some reason one of the columns in the 6th worksheet and all the columns in the 7th worksheet don't work and show up as text in the excel cells. For most of them that aren't working(They're showing up as text in the excel cells) I need them formatted as Numeric with no decimals.
Below is how I'm doing the formatting for some of the stuff that worked previously. Keep in mind this worked for the previous 5 worksheets:
ws.Columns[11].Style.Numberformat.Format = "#####0.0000"; ws.Columns[13].Style.Numberformat.Format = "###,###"; ws.Columns[20].Style.Numberformat.Format = "$###,###,##0.00;($###,###,##0.00)"
I think my issue is when the data in the database is numeric and keeping it numeric in the excel sheet isn't working. Although I just checked and I've dealt with numeric types from the database that format correctly though.. Not sure why it's not working.. What am I missing here folks?
I'm generating excel report in c# in excel.binding data to excel through datatable.
There is one column which will consist of 16 digit number for eg.,1317722825000285 but in excel it is coming as 1317722825000280 last digit is getting replaced by 0.
So how to can I format this column value as excel Text ?
There's a great post here that may answer your question: Format an Excel column (or cell) as Text in C#?
Try formatting the cell as text and making your variable a string in C# before inserting.
Hope this helps.
I am currently serializing a List<SomeObject> to an XML file, which works fine...
In the SomeObject properties, one of them is a string that contains multiple items delimited by the Environment.NewLine character.
When i open the XML file using Excel, some of the cells containing that property, with a few items in them, show up fine (WrapText is set) and yet some others with more items just show up as a string of # signs.
Is there a way to properly show the property's contents with the new lines in there so that Excel displays them correctly, while retaining the original XML? I mean, is this a Serialization issue, or a display setting in Excel i've missed?
The only way i was able to get the text to display properly, was to highlight the entire column in excel, and set the format to Custom -> 0 ... otherwise, in its original format of Text, i only get # signs...
Did you check to see if the XML document was formatted correctly? Because infinite #################### in a cell usually means something is either formatted incorrectly or Excel doesn't understand its type. For example, Excel can't do negative time so subtracting Earlier Date from Later Date = infinite #######. If you hover your mouse over the cell, it may tell you what the issue is.
Currently i'm generating a PDF using iTextSharp in ASP.Net.
One of a field of variable lenght needs to be underlined. Actually in the output file the particular field is shown with lines (as in a ruled notebook).
For example, the field has been allocated 10 lines, so that the user can fill-in depending upon the requirement he has or may be left blank. But, now after automation, data will be fed by the user, which will be later generated as a PDF file, and this particular field is of variable length.
Is there a way i can underline the leading spaces of the field, say only 500 out of 1500 chars width is filled and rest 1000 chars can be underlined. Is there any way i can achieve it with iTextSharp.
i tried it by appending underscores to the actual data (while retrieving it from DB) and underlining the text data by assigning the underline property to the chunk class, but didn't help.
Thanks for any pointers/advise/suggestions
Download http://www.manning.com/lowagie2/samplechapter2.pdf and take a look at the figures in section 2.2.6. Is that more or less what you're looking for? In that case, you need to use a LineSeparator as described in that section.
I currently set some of my fields on my data grid with "c2" as the FormatString. When I generate .csv reports with XtraReports by printing on the XtraGrid, the thousands separator is included in the fields formatted as "c2". I don't want to include the comma in the exported .csvs as external systems have trouble importing the data.
What are my options to remove the comma in the fields in the .csv reports?
Can I just format the data with a preceding $ sign without the thousands separator in the data grid (and what would the FormatString be for that in this case). However, I do like visually having the separator on the grid, just not the .csv file.
Is there some sort of interceptor I can write that will remove commas during report generation?
I suggest that you clear the FormatString property before exporting the grid and revert this property value back when the exporting result is ready. This looks to be the easiest solution to this problem.
Hm... why don't you clone whole grid, assign the datasource to the new one, change the formatting and then print. Is that viable solution to you?