Total Dynamic Report.
-
Hi All, I am back for eating everybodies head. Attached is the excel file in which there are 3 formats of a same table in a report. So based upon these 3 formats I have created 3 different rpt files. Now the client is saying that he can anytime add any number of columns in any place and report should be generated. This means right now if you have look at the excel file, Format 2 has the highest number of column. But he can introduce fields in between or in the beginning or in the end. Right now "Reading Before Adjustment" or "Reading After Adjustment" has 3 columns, but number of columns can either increase or decrease also. So is it possible to dynamically create text object, assign them locations on the report and so on? I did not find the facility of attachment. You can see the attachment here : Here[^]
Thanks and Regards,
-
Hi All, I am back for eating everybodies head. Attached is the excel file in which there are 3 formats of a same table in a report. So based upon these 3 formats I have created 3 different rpt files. Now the client is saying that he can anytime add any number of columns in any place and report should be generated. This means right now if you have look at the excel file, Format 2 has the highest number of column. But he can introduce fields in between or in the beginning or in the end. Right now "Reading Before Adjustment" or "Reading After Adjustment" has 3 columns, but number of columns can either increase or decrease also. So is it possible to dynamically create text object, assign them locations on the report and so on? I did not find the facility of attachment. You can see the attachment here : Here[^]
Thanks and Regards,
you can read excel sheet in c# from first cell to end cell... and you will be insert into generic list from your data. then you can sorting and searching... show under code... it's connect excel ole connect -----------------
DataTable dtTempTable = new DataTable(); DataTable dtMyTable = new DataTable(); DataRow drMyRow; int nRowCount = 0; nRowCount = 0; strSCell\[0\] = "A"; strSCell\[1\] = "1"; strECell\[0\] = "IV"; strECell\[1\] = "65536"; if (CommonLib.IsNullString(FileName.Substring(FileName.Length - 4, 4)).Equals("xlsx")) { // strProvider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + (FilePath + FileName) + ";Extended Properties=Excel 12.0;IMEX=1;HDR=Yes;"; strProvider = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="; strProvider += (FilePath + FileName); strProvider += @";Extended Properties=""Excel 12.0;Imex=1;HDR=YES;"""; strQuery = "Select \* From \[Sheet1$" + strSCell\[0\] + strSCell\[1\] + ":" + strECell\[0\] + strECell\[1\] + "\]"; } else { // strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + (FilePath + FileName) + ";Extended Properties=Excel 8.0;IMEX=1;HDR=Yes;"; strProvider = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="; strProvider += (FilePath + FileName); strProvider += @";Extended Properties=""Excel 8.0;Imex=1;HDR=YES;"""; strQuery = "Select \* From \[Sheet1$" + strSCell\[0\] + strSCell\[1\] + ":" + strECell\[0\] + strECell\[1\] + "\]"; } OLEDBConnection = new OleDbConnection(strProvider); OLECommandObject = new OleDbCommand(strQuery, OLEDBConnection); OLEDBConnection.Open(); if (OLEReader != null) { if (!OLEReader.IsClosed) OLEReader.Close(); } OLEReader = OLECommandObject.ExecuteReader(CommandBehavior.CloseConnection); dtTempTable.Load(OLEReader); if (dtTempTable.Rows.Count > 0) { dtMyTable = dtTempTable.Copy(); } if (OLEReader != null) { if (!OLEReader.IsClosed) OLEReader.Close(); OLEReader.Dispose(); } if (OLEDBConnection != null) OLEDBConnection.Close(); return dtMyTable;
modified on
-
you can read excel sheet in c# from first cell to end cell... and you will be insert into generic list from your data. then you can sorting and searching... show under code... it's connect excel ole connect -----------------
DataTable dtTempTable = new DataTable(); DataTable dtMyTable = new DataTable(); DataRow drMyRow; int nRowCount = 0; nRowCount = 0; strSCell\[0\] = "A"; strSCell\[1\] = "1"; strECell\[0\] = "IV"; strECell\[1\] = "65536"; if (CommonLib.IsNullString(FileName.Substring(FileName.Length - 4, 4)).Equals("xlsx")) { // strProvider = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + (FilePath + FileName) + ";Extended Properties=Excel 12.0;IMEX=1;HDR=Yes;"; strProvider = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="; strProvider += (FilePath + FileName); strProvider += @";Extended Properties=""Excel 12.0;Imex=1;HDR=YES;"""; strQuery = "Select \* From \[Sheet1$" + strSCell\[0\] + strSCell\[1\] + ":" + strECell\[0\] + strECell\[1\] + "\]"; } else { // strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + (FilePath + FileName) + ";Extended Properties=Excel 8.0;IMEX=1;HDR=Yes;"; strProvider = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="; strProvider += (FilePath + FileName); strProvider += @";Extended Properties=""Excel 8.0;Imex=1;HDR=YES;"""; strQuery = "Select \* From \[Sheet1$" + strSCell\[0\] + strSCell\[1\] + ":" + strECell\[0\] + strECell\[1\] + "\]"; } OLEDBConnection = new OleDbConnection(strProvider); OLECommandObject = new OleDbCommand(strQuery, OLEDBConnection); OLEDBConnection.Open(); if (OLEReader != null) { if (!OLEReader.IsClosed) OLEReader.Close(); } OLEReader = OLECommandObject.ExecuteReader(CommandBehavior.CloseConnection); dtTempTable.Load(OLEReader); if (dtTempTable.Rows.Count > 0) { dtMyTable = dtTempTable.Copy(); } if (OLEReader != null) { if (!OLEReader.IsClosed) OLEReader.Close(); OLEReader.Dispose(); } if (OLEDBConnection != null) OLEDBConnection.Close(); return dtMyTable;
modified on
-
Please use the code block button to insert <pre></pre> tags around your code to make it readable. Check the posting guidelines at the top of this forum.
I must get a clever new signature for 2011.
Modify my reply. thanks for your kind.
-
Modify my reply. thanks for your kind.