我使用MATLAB中的指南工具箱设计了一个GUI。基本上这个GUI的作用是在点击“开始”按钮后,它将运行一个生成报告的脚本。
我使用Report Generator工具箱配置报告,因此在脚本中代码如下:
report(buildBiweeklyReport);
其中'buildBiweeklyReport'包含一个模板,包括标题,表格以及一些图像和图形。
但是在编译GUI并单击“开始”按钮后,生成的所有报告中都没有图像或图形。不过,标题和表格都很完美。
更具体地说,我的报告模板中有两种不同的“图像来源”。一个是从.png文件打开的,另一个是由绘图函数生成的,然后通过'Figure Snapshot'包含在报告中。
这是我尝试过的:
答案 0 :(得分:0)
我会检查以确保图像位于可执行文件的路径。在命令行执行命令时,路径可能与路径不同。在代码中添加一行以显示可执行文件正在使用的当前目录(package com.brookfieldres.operations;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Properties;
import java.util.ResourceBundle;
import org.apache.log4j.Logger;
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;
public class SQLConnection {
private static Connection acon = null;
private static CallableStatement _cs = null;
private static String _dbServer = null;
private static String _dbUsername = null;
private static String _dbPassword = null;
private static String _dbName = null;
private static String _dbInstance = null;
private static String _dbWindowsAuthentication = null;
private static final Logger aLogger = Logger.getLogger(SQLConnection.class.getName());
// static ResourceBundle resource = ResourceBundle.getBundle("Resource");
public SQLConnection() {
_dbServer = "localhost";
_dbUsername = "NewLocationTestUser";
_dbPassword = "TestPass123";
_dbName = "NewLocationDB";
_dbInstance = "APPSQL";
_dbWindowsAuthentication = "FALSE";
}
public Connection getConnection() {
SQLServerDataSource ds = new SQLServerDataSource();
Properties properties = new Properties();
try {
String dbURL = "jdbc:sqlserver://" + _dbServer;
if(!_dbInstance.equalsIgnoreCase(""))
{
dbURL += "\\" + _dbInstance;
}
if(_dbWindowsAuthentication.equalsIgnoreCase("TRUE"))
{
dbURL += ";integratedSecurity=true";
}
else
{
properties.put("user", _dbUsername);
properties.put("password", _dbPassword);
}
dbURL += ";";
properties.put("database", _dbName);
acon = DriverManager.getConnection(dbURL, properties);
System.out.println("1");
} catch (Exception e) {
aLogger.error(e.getMessage());
}
finally {
ds = null;
}
aLogger.info("The sql connection has been established.");
return acon;
}
public int insertLocations(Timestamp RunDate, String rlpCompanyid, String rlpLocationid, String rlpOpenDate){
int returnVal = 0;
try{
_cs = getConnection().prepareCall("{call iCurrentLocations01(?, ?, ?, ?)}");
_cs.setTimestamp("RunDate", RunDate);
_cs.setString("CompanyId", rlpCompanyid);
_cs.setString("LocationId", rlpLocationid);
_cs.setString("rlpOpenDate", rlpOpenDate );
returnVal = _cs.executeUpdate();
System.out.println("2");
}catch (SQLException e){
aLogger.error(e.getMessage());
}finally {
if (_cs != null){
try{
_cs.close();
}catch(SQLException e) {
aLogger.error(e.getMessage());
}
}
}
return returnVal;
}
)。