|
Hi,
I am importing data to Excel sheets from Database. For this, I am using datareader. The excel sheet template has some macros and few formulae calculated and its not the normal excel worksheet. so I have to write the data into the excel sheet only if the particular cell is allowed to write. If not, the data shouldn't be imported.
so, for this, I have a XML file which says from which column i should start writing and which row it should stop, I have done for many sheets. But in one sheet, I have first cell of the row is "readonly" and the rest are write access permitted.
As, I get entire row from DB using Datareader, I am stuck up to write to other cells, except for the particular cell.
I am attaching the code snippet for reference. \
Please help me in doing this.
Sample ::
if (reader.HasRows)
{
minRow = 0;
minCol = 0;
Excel.Workbook SelWorkBook = excelAppln.Workbooks.Open(curfile, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, false, false, false);
Excel.Sheets excelSheets = SelWorkBook.Worksheets;
Excel.Worksheet excelworksheet = (Excel.Worksheet)excelSheets.get_Item(CurSheetName);
// Process each result in the result set
while (reader.Read())
{
// Create an array big enough to hold the column values
object[] values = new object[reader.FieldCount];
// Add the array to the ArrayList
rowList.Add(values);
// Get the column values into the array
reader.GetValues(values);
int iValueIndex = 0;
// If the Reading Format is by ColumnByColumn
if (CurTaskNode.ReadFormat == "ColumnbyColumn")
{
minCol = 0;
// minRow = 0;
for (int iCol = 0; iCol < CurTaskNode.HeaderData.Length; iCol++)
{
// Checking whether the Header data exists or not
if (CurTaskNode.HeaderData[minCol] != "")
{
// Assigning the Value from reader to the particular cell in excel sheet
excelworksheet.Cells[CurTaskNode.DATA_MIN_ROW + minRow, CurTaskNode.DATA_MIN_COL + minCol] = values[iValueIndex];
iValueIndex++;
}
minCol++;
}
minRow++;
}
} SelWorkBook.Close(true, curfile, null);
This piece of code reads the data from DB if the reader has rows.It then opens a new preloaded excel template file and assigns the reader data to the Values object. Then for the header length (HeaderData.Length) in XML file it writes to the each excel cell and finally it saves the file and closes. The location where the data is written is excelworksheet.Cells[CurTaskNode.DATA_MIN_ROW + minRow, CurTaskNode.DATA_MIN_COL + minCol] = values[iValueIndex]; // Actually a check needs to be performed b4 this whether to write into cell. i'm not able to do it.
Please help me in resolving this.
Thank You,
Ramm
|
|
|
|
|
Hi,
I am working on a windows application. The requirement that's troubling me is I have an MDI form(Parent form) using which I can navigate to other forms.The view should be in such a way that when the user clicks a menu item--Users Management the window should not open seperately but with in the form. A very good example for this is in web application we have master pages which is common for all the pages. when the user clicks a link only the content in child page changes.
Thanks in advance
|
|
|
|
|
two options that come to mind,
1) Using a tabbed form
2) Panels, then hide and show the panel you want
Weight loss Target
Weight at start [1/Feb/2009] 127kg
Weight now [31/Jul/2009] 107.7kg
Target weight : 80kg
Only 28 TO go hope to be there by March Wish me luck!
|
|
|
|
|
Hi,
Thanks a lot for replying so soon.
but i need a mini,max,close buttons on the top like a normal windows form.
|
|
|
|
|
Wow! Good luck!
Regards,
Jason Pezzimenti.
|
|
|
|
|
You mean something like this[^]
only two letters away from being an asset
|
|
|
|
|
Yeah almost same ...
Thank You
|
|
|
|
|
You must have really got up someones nose - a whole bunch of univotes on your article. Obviously before the comment requirement was put in place
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah, people can be childish at time. I just take an aggrevate view and not worry about these people.
only two letters away from being an asset
|
|
|
|
|
I think you're looking for the Form.MdiParent property. Set it for the child form to be the parent form and the relationship is set.
|
|
|
|
|
Hi,
I did not understand what you are saying.Can you tell in detail.
Let me explain the requirement once again.
when the form is in maximised mode the control box(min,max and restore buttons) of the form should be displayed adjacent to menu bar
In minimised mode the form can be displayed as usual.
My code is given below.
ChildForm ChildFrm= new ChildForm ();
ChildFrm.MdiParent = this;
ChildFrm.TopLevel = false;
splitContainer1.Panel2.Controls.Add(ChildFrm);
ChildFrm.Show();
I've added the Child form to panel2 in split container as I need the form to be displayed in that panel.In minimised mode the form should be movable with in that panel.A very good example of this is Edit plus.
Waiting for your reply
|
|
|
|
|
Hi Member,
The thing is MDI Form is used as Parent Form .and the child forms u can show in it. So u can cascade all the child forms,etc in the main Form .
So make a good design before going in to the coding part.
Regards,
For1206
|
|
|
|
|
Hi,
Thanks a lot. The soln you gave is not in detail. can you please explain in detail. What do you mean by cascade
regards
Member 3057887
|
|
|
|
|
hi
I need to store the value in the common variable and access through out my project.With out using "Application state,session,query string".
Plz help me with this...
Ramkumar
|
|
|
|
|
getramonweb wrote: I need to store the value in the common variable
what's "the common variable" mean?
Are you perhaps looking to use a static variable?...
public static string TheCommonVariable = "MyValue";
... you can then access this value anywhere in your application by referencing it through the class that it is a member of...
string myValue = MyCommonVariableClass.TheCommonVariable;
If that is not what you are looking for then you need to give more details in your question.
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Thanks for your responce ...Let me use in my application and
Let You know the status...
Ramkumar
"know more than others ...Work more than others..Expect less than others"
|
|
|
|
|
I had BHO of How to attach to Browser Helper Object (BHO) with C# in two minutes[^]
The Setsite function is not being called on one PC?
The System configuration is
WindowsXp, IE6, Microsoft.mshtml.dll is added in installation folder,
The Internet Options => Tools => Advanced => Enable third party extensions is also enabled.
Internet Options => Tools => Programs => Manage Addons => BHOHelloWorld.dll => Enabled.
What I'm missing?
Can anyone suggest to solve this?
|
|
|
|
|
Hi All,
This is my first message on this forum. I'm working on a project where i need to create custom installer class, which checks for .NET Framework and SQL Server 2005 before installing, if not found then i need to install the Framework and SQL Server 2005.
What i need to know is how can i check whether framework is installed or not(apart from checking in registry).. is there any way ??
If not installed then how can i install the framework while installing the application ??
Please suggest me a solution how can i achieve this ...
Thanks & Regards
Prakash N
|
|
|
|
|
|
I dont want to use template .. i'm inherting my class from "Installer" ... so i need to know how do you do it using Installer as a base class ..
Thanks N Regards
Prakash N
|
|
|
|
|
Well, you can't check for .NET framework into an installer class: the class will need the Framework to run, so it will crash if there is no .NET installed.
To do what you want, look for Launch Conditions.
|
|
|
|
|
Thanks a lot Mirko. Its helped me a lot
|
|
|
|
|
i just want to know one more thing .. what if i want to install the framework or SQL SERVER 2005 from the directory at the time of installation if the launch condition fails. Please let me know how can i do this ..
|
|
|
|
|
Right click on your setup project and press Properties, a window will open. Then, click on the Prerequisites button.
You will now see a list of packages that your application can depend to, check the ones you want to use and select Download prerequisites from the same location as my application to copy them in the output folder thogether with the msi file and Setup.exe.
If you have Sql Server installed on your machine you should have a Sql Server entry in the list, otherwise, look here.
|
|
|
|
|
i have SQL SERVER 2005 enterprise edition but in the prequisite list it shows SQL SERVER 2005 express edition ?? i dont know why .
I have downloaded BMG (Bootstrap Manifest Generator) tool but it has bugs and i cant generate the manifest .. have any other similar tool ??
|
|
|
|