cell.setVerticalAlignment(Element.ALIGN_MIDDLE) 必须导入什么才能工作?
What has to be imported for cell.setVerticalAlignment(Element.ALIGN_MIDDLE) to work?
我得到了使用该线路的说明
cell.setHorizontalAlignment(Element.ALIGN_MIDDLE);
将单元格的内容居中对齐。
它给我一个错误,说“元素无法解析为
多变的”。
我尽我所能地查找了它,我找到了这条线
com.itextpdf.styledxmlparser.jsoup.select.Elements
但是当我尝试导入时出现错误“导入 com.itextpdf.styledxmlparser 不能
已解决。
我需要做什么才能使对齐代码起作用?
您使用的是哪个版本的 iText?也许您应该使用与您所遵循的说明相匹配的版本。
例如iText 5 examples 显示:
import com.itextpdf.text.Element;
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
iText 7 examples 显示:
import com.itextpdf.layout.property.VerticalAlignment;
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);
我得到了使用该线路的说明
cell.setHorizontalAlignment(Element.ALIGN_MIDDLE);
将单元格的内容居中对齐。 它给我一个错误,说“元素无法解析为 多变的”。 我尽我所能地查找了它,我找到了这条线
com.itextpdf.styledxmlparser.jsoup.select.Elements
但是当我尝试导入时出现错误“导入 com.itextpdf.styledxmlparser 不能 已解决。
我需要做什么才能使对齐代码起作用?
您使用的是哪个版本的 iText?也许您应该使用与您所遵循的说明相匹配的版本。
例如iText 5 examples 显示:
import com.itextpdf.text.Element;
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
iText 7 examples 显示:
import com.itextpdf.layout.property.VerticalAlignment;
cell.setVerticalAlignment(VerticalAlignment.MIDDLE);