我正在尝试使用Apache POI XSLF库为pptx文件设置背景填充颜色.我的代码看起来像这样:
XSLFSlideMaster defaultMaster = ppt.getSlideMasters().get(0);
XSLFSlideLayout layout = defaultMaster.getLayout(SlideLayout.BLANK);
XSLFBackground background = layout.getBackground();
background.setFillColor(Color.BLACK);
Run Code Online (Sandbox Code Playgroud)
结果
Exception in thread "main" java.lang.IllegalStateException: CTShapeProperties was not found.
at org.apache.poi.xslf.usermodel.XSLFShape.getSpPr(XSLFShape.java:240)
at org.apache.poi.xslf.usermodel.XSLFSimpleShape.setFillColor(XSLFSimpleShape.java:549)
Run Code Online (Sandbox Code Playgroud)
我试过在SlideMaster的背景,布局的背景和幻灯片的背景上调用它,都会导致同样的错误.
所以现在我只是想设置一个简单的类,并且无法弄清楚为什么我会出错.这是我的头文件:
#define Mob
class Mob{
private:
int lvl;
float hp;
public:
Mob(int, float); //Error expected an identifier on the float
};
Run Code Online (Sandbox Code Playgroud)
和它的cpp文件
#include "Mob.h"
Mob::Mob(int level, float health) // Error expected an identifier on the int and float
// and an Error: Expected a ; after the )
{
hp = health;
lvl = level;
}
Run Code Online (Sandbox Code Playgroud)