Programmatically access powerpoint file using c# without using office dll
-
Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var app = new Microsoft.Office.Interop.PowerPoint.Application();
var pres = app.Presentations;
var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
file.Export(@"C:\testNew.png", "PNG");
}
}I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah
-
Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var app = new Microsoft.Office.Interop.PowerPoint.Application();
var pres = app.Presentations;
var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
file.Export(@"C:\testNew.png", "PNG");
}
}I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah
Unfortunately Sarah, without using Office you are either going to have to use a specialist 3rd party component, or write one of your own. For the ROI, I'd suggest you should look at Aspose components.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var app = new Microsoft.Office.Interop.PowerPoint.Application();
var pres = app.Presentations;
var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
file.Export(@"C:\testNew.png", "PNG");
}
}I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah
One option to try would be to include a local copy of the reference DLL when deploying to the server. In your project's references, open the properties for the Microsoft Office reference(s). You can set the "Copy Local" value to true. It will copy the assembly to the project's 'bin' path and use that when you deploy it to the server. I've done similar with MySQL assemblies. However, I'm not sure if this is going to work for Office.
-
Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var app = new Microsoft.Office.Interop.PowerPoint.Application();
var pres = app.Presentations;
var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
file.Export(@"C:\testNew.png", "PNG");
}
}I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah
Microsoft uses OpenXML format (or so they say) so don't technically need Office to open/read the file. https://openxmldeveloper.org/[^]
I know the language. I've read a book. - _Madmatt
-
One option to try would be to include a local copy of the reference DLL when deploying to the server. In your project's references, open the properties for the Microsoft Office reference(s). You can set the "Copy Local" value to true. It will copy the assembly to the project's 'bin' path and use that when you deploy it to the server. I've done similar with MySQL assemblies. However, I'm not sure if this is going to work for Office.
-
I believe this will copy only the Interop files. The actual COM DLLs that get the job done should still be identified, copied and registered separately.
That's why I wasn't sure if it would all play well together, or just bring those.
-
One option to try would be to include a local copy of the reference DLL when deploying to the server. In your project's references, open the properties for the Microsoft Office reference(s). You can set the "Copy Local" value to true. It will copy the assembly to the project's 'bin' path and use that when you deploy it to the server. I've done similar with MySQL assemblies. However, I'm not sure if this is going to work for Office.
It won't work for Office - all that will do is copy the PIA across. As these are talking to honking great COM objects, these will need to be installed as well.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Hi, I have the code to programmatically convert slides in powerpoint to images and save in local machine. But this is using the below code that uses the office dll.
using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
var app = new Microsoft.Office.Interop.PowerPoint.Application();
var pres = app.Presentations;
var file = pres.Open(@"C:\test\test.pptx", MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
file.Export(@"C:\testNew.png", "PNG");
}
}I want to do the same without using office dll as the server where i am going to host it does not have office. (My machine has office). Please help Regards, Sarah
As the others have said, there's no easy way to do this yet (At least none that I've heard of)... You MIGHT be able to hack something together yourself, though. The Java POI library is, I believe, capable of converting PPTs to images (But not PPTX), so you could take their code, build your own translator from the PPTX format, and tie them together... It would require interfacing with Java as the NPOI project hasn't, to my knowledge, incorporated PowerPoint functionality yet. If that's too difficult, you might just have to bite the bullet and install Office on the server.
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels) -
Unfortunately Sarah, without using Office you are either going to have to use a specialist 3rd party component, or write one of your own. For the ROI, I'd suggest you should look at Aspose components.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility