Punto informatico Network
Login Esegui login | Non sei registrato? Iscriviti ora (è gratuito!)
Username: Password:
  • Annuncio Pubblicitario

[VB.Net] Streamwriter & Font

Il forum per tutti i developer. Leggere attentamente il regolamento di sezione prima di postare.

[VB.Net] Streamwriter & Font

Messaggioda Pesko » dom apr 03, 2011 12:36 pm

Ciao a tutti,
Dovrei creare un programma in vb.net che crea delle lettere in formato .rtf , ho utilizzato Streamwriter ed il programma funziona bene ma ho necessità che alcune righe della lettera abbiano font e dimenzione diversa, come posso fare per cambiare il carattere? Allego il codice del programma

Imports System.IO

Public Class Form2
Dim Cr As String
Dim Ot As String
Dim Da As String
Dim go As String
Dim ca As String
Dim la As String
Dim tx As String
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

End Sub

Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Qualifica.TextChanged

End Sub

Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Nome.TextChanged

End Sub

Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Giorno.TextChanged

End Sub

Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDBT1.CheckedChanged

End Sub

Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDBT2.CheckedChanged

End Sub

Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dal.TextChanged

End Sub

Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Al.TextChanged

End Sub

Private Sub RadioButton4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDBT3.CheckedChanged

End Sub

Private Sub TextBox6_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Motivazione.TextChanged

End Sub

Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtSalva.Click
Dim sw As New IO.StreamWriter(SaveFileDialog1.FileName)
sw = File.CreateText(Application.StartupPath & "\Indisponibilità.rtf")
sw.WriteLine()
sw.WriteLine("OGGETTO: PERIODO DI INDISPONIBILITA A DIRIGIRE GARE")
sw.WriteLine()
sw.WriteLine("Io sottoscritto,Qualifica " & Qualifica.Text & " " & Nome.Text)
sw.WriteLine()
sw.WriteLine("Sezione di" & sezione.Text & "e attualmente a disposizione: " & Cr & Ot)
sw.WriteLine()
sw.WriteLine("dichiara la propria INDISPONIBILITA come sotto indicato:")
sw.WriteLine()
sw.WriteLine()
If RDBT1.Checked Then
go = Giorno.Text
sw.WriteLine("NON DISPONIBILE nel giorno " & go)
ElseIf RDBT2.Checked Then
Da = Dal.Text
la = Al.Text
sw.WriteLine("NON DISPONIBILE nel periodo dal " & Da & "al " & la)
ElseIf RDBT3.Checked Then
sw.WriteLine("Come da calendario allegato.")
End If
sw.WriteLine("Motivo dell'indisponibilita: " & Motivazione.Text)
sw.WriteLine()
sw.WriteLine("Colgo l'occasione per porgere distinti saluti")
sw.WriteLine()
sw.WriteLine("Data ____/____/____")
sw.WriteLine()
sw.WriteLine("Firma")
sw.WriteLine("__________________________________________")
sw.Flush()
sw.Close()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtEsci.Click
Close()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtStampa.Click

End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CRA.CheckedChanged
If CRA.Checked Then
Cr = "CRA"
Else
Cr = " "
End If
End Sub

Private Sub OTP_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OTP.CheckedChanged
If OTP.Checked Then
Ot = "OTP"
Else
Ot = " "
End If
End Sub

Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblsezione.Click

End Sub

Private Sub TextBox1_TextChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sezione.TextChanged

End Sub
End Class


Ringrazio in anticipo per l'aiuto.
Un uomo che può sorridere quando le cose vanno male... ha trovato qualcuno a cui dare la colpa.
Avatar utente
Pesko
Neo Iscritto
Neo Iscritto
 
Messaggi: 21
Iscritto il: lun feb 28, 2011 5:58 pm

Re: Streamwriter & Font

Messaggioda dararag » gio apr 07, 2011 7:05 pm

l'rtf è un tipo di documento che salva la formattazione del contenuto all'interno del file stesso, con semplici stringhe di testo [^] devi solo cercare le specifiche dei file rtf e vedere come viene definito un font [;)] o fanne un paio con font diversi e analizzali aprendoli con il blocco note [:)]
Maledette aziende produttrici, l'unico telefilm interessante degli ultimi tempi l'hanno interrotto alla decima puntata... e chi voleva sapere la fine?
Avatar utente
dararag
Silver Member
Silver Member
 
Messaggi: 1116
Iscritto il: mar gen 22, 2008 8:57 pm
Località: Casoria


Torna a Programmazione

Chi c’è in linea

Visitano il forum: Nessuno e 7 ospiti

Powered by phpBB © 2002, 2005, 2007, 2008 phpBB Group
Traduzione Italiana phpBB.it

megalab.it: testata telematica quotidiana registrata al Tribunale di Cosenza n. 22/09 del 13.08.2009, editore Master New Media S.r.l.; © Copyright 2008 Master New Media S.r.l. a socio unico - P.I. 02947530784. GRUPPO EDIZIONI MASTER Spa Tutti i diritti sono riservati. Per la pubblicità: Master Advertising