Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法在从html文件呈现的aspose ppt中嵌入样式_Java_Html_Css_Aspose_Pptp - Fatal编程技术网

Java 无法在从html文件呈现的aspose ppt中嵌入样式

Java 无法在从html文件呈现的aspose ppt中嵌入样式,java,html,css,aspose,pptp,Java,Html,Css,Aspose,Pptp,我正在使用AsposeJava库将html转换为ppt。但是,我无法生成诸如(填充、背景色等)之类的样式,而诸如(颜色、字体大小)之类的样式工作正常,请查看代码 public class poi { public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir =

我正在使用AsposeJava库将html转换为ppt。但是,我无法生成诸如(填充、背景色等)之类的样式,而诸如(颜色、字体大小)之类的样式工作正常,请查看代码

 public class poi {

        public static void main(String[] args) throws Exception {

            // The path to the documents directory.
            String dataDir = Utils.getDataDir(poi.class);

            // Create Empty presentation instance
            Presentation pres = new Presentation();

            // Access the default first slide of presentation
            ISlide slide = pres.getSlides().get_Item(0);

            // Adding the AutoShape to accommodate the HTML content
            IAutoShape ashape = slide.getShapes().addAutoShape(ShapeType.Rectangle,  50, 150, 300, 150);

            ashape.getFillFormat().setFillType(FillType.NoFill);

            // Adding text frame to the shape
            ashape.addTextFrame("");

            // Clearing all paragraphs in added text frame
            ashape.getTextFrame().getParagraphs().clear();

            // Loading the HTML file using InputStream
            InputStream inputStream = new FileInputStream(dataDir + "file.html");
            Reader reader = new InputStreamReader(inputStream);

            int data = reader.read();
            String content = ReadFile(dataDir + "file.html");

            // Adding text from HTML stream reader in text frame
            ashape.getTextFrame().getParagraphs().addFromHtml(content);

            // Saving Presentation
            pres.save(dataDir + "output.pptx", SaveFormat.Pptx);


        }

        public static String ReadFile(String FileName) throws Exception {

            File file = new File(FileName);
            StringBuilder contents = new StringBuilder();
            BufferedReader reader = null;

            try {
                reader = new BufferedReader(new FileReader(file));
                String text = null;

                // repeat until all lines is read
                while ((text = reader.readLine()) != null) {
                    contents.append(text).append(System.getProperty("line.separator"));
                }
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                try {
                    if (reader != null) {
                        reader.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }

            return contents.toString();

        }

    }
正如您所看到的,我正在加载具有内联样式的html文件,但是我无法完全加载大部分css元素。有什么建议吗?

@Balchandar Reddy

我已经注意到您的要求,并愿意与大家分享目前Aspose.Slides支持基本文本导入,同时在使用Aspose.Slides生成的演示文稿中支持有限的标记。我请求您将所需的HTML与您希望在Aspose.Slides中获得支持的所需标记共享。我将与我们的产品团队讨论这一点,并将其作为新功能请求添加到我们的问题跟踪系统中


我在Aspose担任支持开发者/布道者。

我的要求非常复杂,它包括html表格,每个单元格有不同的背景颜色,有些页面有各种图表,如条形图、列和饼图等。这可能与Aspose有关吗?@Balchandar Reddy目前,幻灯片仅支持从HTML到演示文稿文本框架的基本文本导入。