example code:
[CommandMethod("Test")] public static void TestMethod() { Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; Database db = doc.Database; using (Transaction Tx = db.TransactionManager.StartTransaction()) { BlockTableRecord bt = Tx.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord; foreach (ObjectId id in bt) { if (id.ObjectClass.Name != "AcDbOle2Frame") continue; Ole2Frame oleFrame = Tx.GetObject(id, OpenMode.ForRead) as Ole2Frame; if (! oleFrame.IsLinked) { Microsoft.Office.Interop.Excel.Workbook wb = oleFrame.OleObject as Microsoft.Office.Interop.Excel.Workbook; Microsoft.Office.Interop.Excel.Worksheet ws = wb.ActiveSheet; Microsoft.Office.Interop.Excel.Range range = ws.UsedRange; for (int row = 1; row <= 15; row++) { for (int col = 1; col <= range.Columns.Count; col++) { ed.WriteMessage(String.Format("{0}{1}{2}-{3}", Environment.NewLine, row, col, Convert.ToString((range.Cells[row, col] as Microsoft.Office.Interop.Excel.Range).Value2))); } } } } }
1-autocad program will be closed
2-be selected within the file path c sharp example: csharp.jpg
3-I want to read data from a DWG excel file using C#. examples: dwgfile.jpg and drawing1.dwg
4-I want to list here DataGridView data
5-c sharp winform .net 4.0
Can you help me?