importing parameters from excel to revit by api and epplus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hey everyone i import parameters into excel by epplus but i dont know when i change my excel file my revit become changed too.this is my code.
i thank you for helping me
{
Document doc = commandData.Application.ActiveUIDocument.Document;
string fileman = Path.Combine(Path.GetTempPath(), "MyExcel.xlsx");
if (File.Exists(fileman)) { File.Delete(fileman); }
using (ExcelPackage pg = new ExcelPackage(new FileInfo(fileman)))
{
ExcelWorksheet sheet = pg.Workbook.Worksheets.Add("Doors");
int row = 1;
foreach(Element e in FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_Doors)) {
sheet.Cells[row, 1].Value = e.Name;
sheet.Cells[row, 2].Value = e.Id;
sheet.Cells[row, 3].Value = e.Category;
row++; }
pg.Save();
} Process.Start(fileman);
return Result.Succeeded;
}