Hi
Which is the best way to export xamlgrid to excell sheet?
Thanks
MK
bwilemon,
I noticed your post and I'm trying to do the same thing. Your post is a little older so you may have moved on, but I was curious if you ran into any solutions. I have been using "cell.ConvertedValue.ToString();" to get to the value from the converters, but it seems very buggy. In 95% of the cases it's giving me the converted value, but in a smaller (somewhat random) set of cases I'm not getting the converted value even thought the grid is obviously called the converter. The issue seems to happen more often on fields where the converter is in an EditorStyle.
any help here?
This works fine if the data hasn't gone through a converter. Is there a way to the "actual" text from the cell. For example, i'm trying to get walk the viewable records for export. When i come across "7/15/2008" in my cell.value this is actually displayed as Tue and not the date. If i could get to the textblock inside cellvaluepresenter, would that work?
foreach (Record record in this.xamDataGrid1.ViewableRecords)
{
StringBuilder recordAsString = new StringBuilder(); if (record is DataRecord) { foreach (Cell cell in ((DataRecord)record).Cells) { recordAsString.Append(cell.Value.ToString() + ","); } } // Feed this 'record as string' to Excel. For now, just print it in the debug window. Debug.Print(recordAsString.ToString());
StringBuilder recordAsString = new StringBuilder();
if (record is DataRecord)
foreach (Cell cell in ((DataRecord)record).Cells) { recordAsString.Append(cell.Value.ToString() + ","); }
foreach (Cell cell in ((DataRecord)record).Cells)
recordAsString.Append(cell.Value.ToString() + ",");
}
// Feed this 'record as string' to Excel. For now, just print it in the debug window.
Debug.Print(recordAsString.ToString());