Click here to Skip to main content
16,021,430 members

Comments by bellpatricia (Top 6 by date)

bellpatricia 5-Oct-17 4:11am View    
My solution was to use a DocumentViewer control and I would display my slides on it by converting my powerpoint file to XpsDocument object. For an example see this, note that it uses this presentation library for c#.
bellpatricia 5-Oct-17 4:05am View    
The only way how you could do this is to convert your slides into some other format that can be displayed in browsers. For example, one solution would be to convert your powerpoint to pdf file in c#, or to an image file or to something else.
Here is a small sample code that uses a powerpoint library for .net framework:

var presentation = PresentationDocument.Load("Sample.pptx",
new PptxLoadOptions());
presentation.Save("Sample.pdf",
new PdfSaveOptions());

If you want to save to an image, then change the output file's name and use "ImageSaveOptions" instead or "PdfSaveOptions".
After you generate/convert your powerpoint of a compatible file format for browsers, then you just need to set the iframe's src to that file's location.
bellpatricia 5-Oct-17 3:53am View    
Andrew mentioned below that Office Interop is free, but that's not true, actually far from it. In order to use Microsoft Excel Interop in c# you need to buy and install Microsoft Office. Also you need to have Microsoft Office installed on all machines where you're running your code, otherwise the execution will fail.

Compare to that the standalone 3td party can be a cheaper and a convenient solution. For instance, take a look at these: c# library for Excel and c# library for PowerPoint.
With those libraries you don't need to install and have Microsoft Office. Also there are couple of ways how you could do this conversion, for instance you could read an Excel file in c# and then generate a PPTX file in c# and add a slide with a table element for each sheet in your Excel file.
bellpatricia 4-Oct-17 5:17am View    
Here is a straightforward way how you can create / generate a PDF file in C#:

var document = new DocumentModel();
document.Content.LoadText("Sample text.");
document.Save("Sample.pdf");

You need this PDF library for C# to run the code.
bellpatricia 22-Sep-17 3:40am View    
One of the simpler approaches that you can take is by using this C# and VB.NET library for Excel, like this:

ExcelFile book = new ExcelFile();
ExcelWorksheet sheet = book.Worksheets.Add("Sheet1");

sheet.Cells[1, 1].Value = this.label1.Text;
sheet.Cells[1, 2].Value = this.combSOName.SelectedValue.ToString();
sheet.Cells[1, 4].Value = this.label3.Text;
sheet.Cells[1, 5].Value = this.comboPartno.Text;

DataGridViewConverter.ImportFromDataGridView(sheet, this.dataGridView1,
    new ImportFromDataGridViewOptions(6, 1) { ColumnHeaders = false });
DataGridViewConverter.ImportFromDataGridView(sheet, this.dataGridView2,
    new ImportFromDataGridViewOptions(24, 1) { ColumnHeaders = false });

If interested, you can find a full example of exporting DataGridView to Excel in C# and VB.NET here.