private void BtnEsporta_Click(object sender, EventArgs e)
{
using (SaveFileDialog dlg = new SaveFileDialog
{
Title = "Salva file in formato RTF",
Filter =
"File RTF (*.rtf)",
DefaultExt = "rtf",
FileName
= "Documento.rtf"
})
{
if (dlg.ShowDialog()
== DialogResult.OK)
{
try
{
// Salva come RTF senza oggetti OLE
rtbResults.SaveFile(dlg.FileName,
RichTextBoxStreamType.RichNoOleObjs);
}
catch (Exception ex)
{
MessageBox.Show($"Errore: {ex.Message}", "Errore salvataggio", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
Nessun commento:
Posta un commento