So I have been working on this ppt add-in. I have been saving strings mostly using the tags hash and it has worked fine thus far; however, now I need to essentially save a 2D array to the presentation. I chose the use the datagridview component and placed it in a new form.
Once the user inputs his data and the form is ready to close I have no idea where to save the grid. I essentially would like to access it later as a 2D array of some sort (there are probably easier ways to access this data); however, first I need to save it to the presentation some how.
Does powerpoint just serialize the entire presentation object and save it entirely? In this case can I just do something like:
PowerPoint.Presentation preso = Globals.ThisAddIn.Application.ActivePresentation;
preso.myGrid = theGridViewFromTheForm;
Or something along those lines?
Ideas?
There are two option to save data of datagridview. First using serialize class second using Datatable. Second solution: Serialize your datatable in text and save it into presentation or slide tag.
public static string TableToString(this DataTable data)
{
string xmlString = string.Empty;
using (TextWriter writer = new StringWriter())
{
data.WriteXml(writer,XmlWriteMode.WriteSchema );
xmlString = writer.ToString();
}
return xmlString;
}
I simply saved everything using Tags. I suppose you can save things in other ways that aren't so obvious.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.