Zawijanie tekstu przy drukowaniu.

0

Witam
Mam problem z drukowaniem tabelki Używam:

Wywołanie:
try {
new Drukuj();
}
catch (PrinterException ex)
{
Logger.getLogger(Okno_planowanie_harmonogramu.class.getName()).log(Level.SEVERE, null, ex);

0

Nie dokończyłem pisać ;/

class DrukujMarcina
{
public DrukujMarcina() throws PrinterException
{
table_marcina.print();
}}

Wywołanie:
try {

  } catch (PrinterException ex) {
    Logger.getLogger(Okno_planowanie_harmonogramu.class.getName()).log(Level.SEVERE, null, ex);

No i oczywiście ucina mi tekst, chciałbym aby tabelka sie wydłuzyła tak aty tekst sie w niej zmieścił.

Podobnie mam mam w drukowaniu juz z pominięciem tebelki:

class Drukuj implements Printable
{
public int print(Graphics g, PageFormat pageFormat, int page)
{
//Pomocnicze sprawy ---------------------------------------------------
SimpleDateFormat formatdaty = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
String data_na_wydruk = formatdaty.format(calendar.getTime());
//---------------------------------------------------------------------
Font naglowek = new Font("TimesRoman", Font.BOLD, 12);
Font pogrubione = new Font("TimesRoman", Font.BOLD, 10);
Font srodek =new Font("TimesRoman", Font.ITALIC, 10);
Font tekst = new Font("TimesRoman", Font.PLAIN, 10);
//---------------------------------------------------------------------
g.setFont(naglowek);
g.drawString("CRM Medicsoft - Wydruk harmonogramu pracy.", (int)
pageFormat.getImageableX()+10,(int) pageFormat.getImageableY() + 20);
g.setFont(srodek);
g.drawString("Pracownik: Robert",(int) pageFormat.getImageableX()+10,(int)
pageFormat.getImageableY() + 50);
g.drawString(data_na_wydruk,(int) pageFormat.getImageableX()+500,(int)
pageFormat.getImageableY() + 50);

g.drawString("--------------------------------------------------------------------------------------------------------------------------------------------------------------------", (int) pageFormat.getImageableX()+10,(int) pageFormat.getImageableY() + 60);
g.setFont(pogrubione);
g.drawString("Klient", (int) pageFormat.getImageableX()+10,(int) pageFormat.getImageableY() + 70);
g.drawString("Cel", (int) pageFormat.getImageableX()+120,(int) pageFormat.getImageableY() + 70);
g.drawString("Rozwiązanie", (int) pageFormat.getImageableX()+400,(int) pageFormat.getImageableY() + 70);
g.setFont(srodek);
g.drawString("--------------------------------------------------------------------------------------------------------------------------------------------------------------------", (int) pageFormat.getImageableX()+10,(int) pageFormat.getImageableY() + 80);
int wiersz=90,wiersz_koncowy=0;
g.setFont(tekst);
for(int i=0;i<licznik_roberta;i++)
{
g.drawString(dane_roberta[i][2], (int) pageFormat.getImageableX()+10,(int) pageFormat.getImageableY() +wiersz );
g.drawString(dane_roberta[i][4], (int) pageFormat.getImageableX()+120,(int) pageFormat.getImageableY() +wiersz);
g.drawString(dane_roberta[i][5], (int) pageFormat.getImageableX()+400,(int) pageFormat.getImageableY() +wiersz);
wiersz=wiersz+20;
wiersz_koncowy=wiersz;
}
g.drawString("-------------------------------------------------------------------------------------------------------------------------------------------------------------------", (int) pageFormat.getImageableX()+10,(int) pageFormat.getImageableY() + wiersz_koncowy);
return (page == 0 ? PAGE_EXISTS : NO_SUCH_PAGE);
}
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1