I'm using Excel's data validation lists, checking if the cell value is into a dynamic range (the cell values of another column).
The problem is that if I add a value into the source range (eg. "A"), I can input that value on the cell with data validation. But then, if I change the source (eg from "A" to "B") the cell with data validation is still "A".
In Excel there's a button that sets a red circle around invalid data, but client does not always check if everything is good.
Can I perform that check with EPPLUS?
The documentation doesn't suggest that this check can be performed by EPPlus:
https://www.epplussoftware.com/Developers/Features mentions "Create, read, modify, delete Data validations" and links to sample code in their wiki, which is all about designing the sheet and inspecting its design, no content validation.
I've searched the source code and looked at ExcelDataValidation.cs and its various sub-types. Their "Validate" methods only check if the validation is properly defined according to Excel's rules.
To achieve what you're asking for, you'll have to use EPPlus to get the validation from the cell, interpret it depending on its type and evaluate the cell content. There is an example that touches some of the cases and could give you an idea where this is heading.
I have created an asp.net website,which stores data into an ms-excel sheet from the webpage,the problem is,all other column values except the first column(register number)are correct.when we open the sheet it displays a value "2.11511E+11" in the register number column.Why so? Im new to using ms-excel,pls help. And the datatype i used for register number is "long".
This is just the format of the cell (represention)
Look at this tutorial to change represention
Can you please let me know how I can use C# to read a specific column values base on the column header?
For example, let say I have a column with header "pAge" how I can loop into the column and update values for the specific rows related to the garbed values. What I want to do is looping in "pAge" column and find all ages over 50 then change the value of those rows in other column "Eligible" to "yes"
The reason that i would like to use the column header instead of column range is because I am getting some data from our clients which are not necessarily in the same order but they have always same name.
Thanks for your time
try using this linq to ecxel library it should help you achieve what you are looking for
http://code.google.com/p/linqtoexcel/
I am Working on Microsoft C#.net(windows)
I have a requirement ,
I have an excel file containing formatted text in a cell (ex: text will be bold,italic,color) . I need to save the cell content in to the sql database.
Then i need to show the saved formatted text from database to a new excel file.
How to assign RTF code and HTML code to Excel cell.
Is there any option available. Please help
Thanks
Sandeep
i think you can use openxml to split the data along with cell formart and save in different tables in your db by referencing some id.
Lets say sheet 1 has sheetid as 1 and against this sheet id save data in your table and against same sheetid save cell number and style associated like font border fill.
Below Link can be helpful.
http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.cellformat.aspx
I am writing code for the same will share soon
I have an excel file(VSTO), which will be uploaded with data.
However I want to make one cell invisible, as it contains one of the ID's which should not be revealed to the user.
I use Excel.Range.Value2 property to set the value.
Now I want to make the value inside it invisible
I am using C#, how do I accomplish the above.
This will make cell content invisible, untill you click on them then you can change the data. Here
Microsoft.Office.Interop.Excel.Range descriptionRange31 = xlApp.get_Range("A18,A25,B18,B25");
descriptionRange31.NumberFormat = ";;;";
I am not sure how to make it invisible. However, you can just copy and save the value in a variable in memory and replace it by string.Empty.
Declare the variable in your plug-ins application object in such a way that it stays alive as long as Excel is open.
If you want to persist it even when Excel application is closed, then either write it to disk or save it in the properties of the Excel workbook (the same place that is visible in Properties page of the workbook) after encoding it.
I have worked on the VSTO Excel applications.
In my project i have used specials Ids to identify each column uniquely..
So, i would suggest rather than getting into coding you can do following 2 actions to make it invisible.
Go to ur visual studio, open design mode of the workbook.
Enter ur ids in columns or rows , wherever u want to (lets assume in column C and Row 5,6)
1.You can see the horizontal / vertical strips at the top and left side of excel which we use to resize the columns n rows ..just adjust it in a such a way that that particular column will be hidden
as u can see the image, i adjusted columns to Hide Column "C" and Rows to hide row no 5 and 6.
2.Now open excel (not from Visual stodio, from windows explorer) pres Alt+T+P+P
and protect the sheet using a perticular password and your are done.
Now user can not make any changes in columns or rows and date remains invisible.
Regards,
Sangram Nandkhile
I'm not sure you can make the contents of a cell "invisible." However, you could go a long way toward that goal by:
Placing the hidden information within a hidden column in a separate worksheet
Password protecting the worksheet structure to prevent unhiding of that hidden column
Hiding the protected worksheet
Password protecting the workbook's VBA project from editing
The security of this approach is not 100% because Excel protection is not exceedingly difficult to break. However, the combination of obscurity (since the worksheet tab is not even visible to the user) and protection of the VBA Project from editing (so even if someone knows the hidden sheet is there, it won't be as easy to code the unhide method) and password protection of the worksheet structure (so it won't be easy to unhide the protected column) should prevent all but the most determined peekers from seeing what you're hiding.
I have not worked with VSTO, so I can't code this for you. The approach is valid though, and all API hooks to achieve it are probably available.
I'm not sure if this answer match your level of question, but this if I would into your problem description. I would just make the font color same as the background and lock the cell from editing (which you of course handle from code, while write/change the value) and go for locking the excel sheet except the cells/regions that explicitly marked as opened.