Embedding OLE object in PPT

I am reading an ole binary object from a sql server database and embedding into a .ppt. After doing the embed when I open the ppt I see an that an “object changed” . Which is expected and described here:
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

http://www.aspose.com/documentation/.net-components/aspose.slides-for-.net/object-changed-issue-when-adding-oleobjectframe.html

However, when I follow these instructions I receive an error that states ,"
The server application, source file, or item can’t be found, or returned
an unknown error. You may need to reinstall the server application."

Does anyone have any experience with this issue ?

Here is the code,


import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


public class Tester {

private Connection conn;


public static void main ( String[] args)
{
try {
Tester test = new Tester();

test.getImageData();
} catch ( Exception e )
{
e.printStackTrace();
}
}




public void getImageData() throws SQLException
{
String query;
ResultSet rs=null;
Statement state =null;
try
{
String url = “jdbc:sqlserver://x:2555;databaseName=x”;
conn = DriverManager.getConnection(url, “x”, “x”);
query = “select * from x where x =1295”;
state = conn.createStatement();
rs = state.executeQuery(query);
if (rs.next())
{
Blob aBlob = rs.getBlob(“file”);
byte[] allBytesInBlob = aBlob.getBytes(1, (int) aBlob.length());
createEmbeddedDocument2( allBytesInBlob);


}

}
catch (Exception e)
{
e.printStackTrace();
} finally {
state.close();
rs.close();
conn.close();
}



}


private void createEmbeddedDocument2( byte c[]) throws Exception
{
try
{

//Instantiate a Presentation object that represents a PPT file
com.aspose.slides.Presentation pres = new com.aspose.slides.Presentation(new FileInputStream(new java.io.File(“C:\aWebDeployment\demo.ppt”)));
//Accessing a slide using its slide position
com.aspose.slides.Slide slide = pres.getSlideByPosition(1);
//Inserting the excel chart as new OleObjectFrame to a slide
com.aspose.slides.OleObjectFrame oof = slide.getShapes().addOleObjectFrame(0,0,(int)pres.getSlideSize().getX(),
(int)pres.getSlideSize().getY(),“Excel.Sheet.8”, c);
//Writing the presentation as a PPT file
pres.write(new FileOutputStream(new java.io.File(“C:\aWebDeployment\modified.ppt”)));

}

catch(Exception ex)

{

System.out.println(ex.toString());

}
}


}

Hi Chris,


Thanks for your interest in Aspose.Slides.

It would be great, If you can share your database table structure and presentation file in database for investigation purpose. We are really keen to help you but need further details from your side.

table

CREATE TABLE [dbo].[ProdAttach](
[ProdAttachID] [int] IDENTITY(1,1) NOT NULL,
[ProdHdrID] [int] NOT NULL,
[Description] nvarchar NULL,
[File] [image] NULL,
[Created] [smalldatetime] NOT NULL,
[CreatedBy] nvarchar NULL,
PRIMARY KEY CLUSTERED
(
[ProdAttachID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

Hi Chris,


Thanks for sharing the information, I am working on this issue and will update you soon.

Hi Chris,


I have modified the createEmbeddedDocument2 method, please use the following code snippet. Please make sure that the JPG file exists at specified path.

private void createEmbeddedDocument2( byte c[]) throws Exception
{
try
{
//Instantiate a Presentation object that represents a PPT file
com.aspose.slides.Presentation pres = new com.aspose.slides.Presentation(new FileInputStream(new java.io.File(“d:\demo.ppt”)));
//Creating a stream to hold the image file
InputStream iStream = new BufferedInputStream(new FileInputStream(“C:\Chrysanthemum.jpg”));
//Creating a picture object
Picture pic = new Picture(pres, iStream);
//Adding the picture to presentation and getting the related picture Id
int picId = pres.getPictures().add(pic);

//Accessing a slide using its slide position
com.aspose.slides.Slide slide = pres.getSlideByPosition(1);
//Inserting the excel chart as new OleObjectFrame to a slide
com.aspose.slides.OleObjectFrame oof = slide.getShapes().addOleObjectFrame(0,0,(int)pres.getSlideSize().getX(),
(int)pres.getSlideSize().getY(),“Excel.Sheet.8”, c);
oof.setPictureId(picId);
//Writing the presentation as a PPT file
pres.write(new FileOutputStream(new java.io.File(“d:\modified.ppt”)));
}
catch(Exception ex)
{
System.out.println(ex.toString());
}
}

let me know, if you still face any issue