how to change the contents in text file to ppt file with bullets ...

My code for wat i tried to shift the contents to ppt from java is:

import java.io.*;
import java.util.*;
class Filereader
{
public static void main(String args[])throws Exception{
FileReader fr = new FileReader("E:\backup_javaprog\file.java");
BufferedReader br=new BufferedReader(fr);
SlideShow ppt = new SlideShow();
Slide s1 = ppt.createSlide();
FileOutputStream out = new FileOutputStream("slideshow.ppt");
ppt.write(br);
fr.close();
// out.close();
}
}

And am getting the error as:

D:\program files\Java\jdk1.5.0\bin>javac Filereader.java
Filereader.java:8: cannot find symbol
symbol : class SlideShow
location: class Filereader
SlideShow ppt = new SlideShow();
^
Filereader.java:8: cannot find symbol
symbol : class SlideShow
location: class Filereader
SlideShow ppt = new SlideShow();
^
Filereader.java:9: cannot find symbol
symbol : class Slide
location: class Filereader
Slide s1 = ppt.createSlide();
^
3 errors

Locate the error so tat i can try it out...

Recommended Answers

All 3 Replies

The error would be that you have not imported the classes SlideShow and Slide. I assume you have some library with these classes like POI? You must import the classes to use them and make sure the jar file is in your classpath.

I tried this code to read the contents from the text file and putting it in slides(ppt). so am getting one error as incompatible type..can anyone locate it. Leave the second error i think i should import any files.

Code:

import java.io.*;
import java.lang.String.*;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hslf.model.*;
import org.apache.poi.hslf.*;


class filecreater
{
public static void main(String args[])throws Exception
{
try
{
FileReader fr = new FileReader("E:\backup_javaprog\file.java");
BufferedReader br=new BufferedReader(fr);
String ip[]=br;
SlideShow ppt = new SlideShow();
Slide s1 = ppt.createSlide();
TextBox shape = new TextBox();
FileOutputStream out = new FileOutputStream("slideshow.ppt");
shape.setText(ip);
ppt.write(out);
fr.close();
}
catch (Exception e )
{
e.printStackTrace();
}
}


Error:


D:\program files\Java\jdk1.5.0\bin>javac filecreater.java
filecreater.java:24: incompatible types
found   : java.io.BufferedReader
required: java.lang.String[]
String ip[]=br;
^
filecreater.java:29: setText(java.lang.String) in org.apache.poi.hslf.model.Text
Box cannot be applied to (java.lang.String[])
shape.setText(ip);
^
2 errors

You cannot simply set an array equal to a BufferedReader to get it's contents. You must read the contents in a loop (with readLine() for example) and place the data in your array as appropriate.
The second error is of similar nature - you cannot send a String array to a method that takes a simple String as a parameter.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.