Visualizzazione dei risultati da 1 a 2 su 2

Discussione: C# e Powerpoint

  1. #1
    Utente di HTML.it L'avatar di cms9651
    Registrato dal
    Mar 2010
    Messaggi
    107

    C# e Powerpoint

    Buonasera a tutti.

    Sto provando a manipolare un presentazione powerpoint tramite aspnet.

    La pagina aspx lanciata sul browser non dà errori ma il file powerpoint 'temp.ppt' non viene salvato nella cartella 'public', cioè rimane nella versione iniziale.

    Cosa sbaglio?

    codice:
    <%@ Page Title="Home page" Language="C#" AutoEventWireup="true" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.Odbc" %>
    <%@ Import Namespace="System.Configuration" %>
    <%@ Import Namespace="System.Security.Principal" %>
    <%@ Import Namespace="System.Drawing" %>
    <%@ Import Namespace="System.Runtime.InteropServices" %>
    <%@ Import Namespace="Microsoft.Office.Interop.PowerPoint" %>
    <%@ Import Namespace="Microsoft.Office.Core" %>
    
    ....
    
    <script runat="server">
    
    private void Page_Load(object sender, System.EventArgs e)
        {
            OdbcConnection myConnectionString = new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnMySQL"].ConnectionString);
            try
            {
                myConnectionString.Open();
    
                string FilePPTDaSalvare = @"D:\\Inetpub\\wwwroot\\public\\temp.ppt";
               
                Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
                Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
                Microsoft.Office.Core.MsoTriState otrue = Microsoft.Office.Core.MsoTriState.msoTrue;
                pptApp.Visible = otrue;
                pptApp.Activate();
                Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;
                Microsoft.Office.Interop.PowerPoint.Presentation p = ps.Open(FilePPTDaSalvare, ofalse, ofalse, otrue);
                p.SaveAs(FilePPTDaSalvare, PpSaveAsFileType.ppSaveAsPresentation, MsoTriState.msoTrue); 
                System.Diagnostics.Debug.Print(p.Windows.Count.ToString());
    
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                myConnectionString.Close();
                myConnectionString.Dispose();
            }    
            
    
                      
        }
    
    </script>

  2. #2

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.