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]>
<![endif]–>
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());
}
}
}