(Jestem początkujący w C# ! Więc proszę nie krytykować.. a choćby o kawałeczek pomocy. Dziękuję)
Witam, na zajęcia muszę napisać program w WPF'ie tak aby stworzyć tabelkę w 3 formatach: HTML, PS, PDF. Za te dwa ostatnie nie wiem jak się zabrać. Mamy zrobić to za pomocą podmiany tekstu (patrz zdjęcia)
W HTML, najpierw stworzyłem plik .txt i kod tabelki oraz przypisałem nazwy w programie do podmiany, ale nie wiem jak to zrobić z PDF i PS... też przerobić z .txt na PS i PDF, czy od razu podmieniać w tych formatach.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
namespace Wizytówka_HTML_PS_PDF
{
/// <summary>
/// Logika interakcji dla klasy MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
if (HTML.IsChecked==true)
{
string n = Name.Text;
string s = Surname.Text;
string d = DateOfBirth.Text;
string nb = NameOfBusiness.Text;
string p = Position.Text;
string templateFile = File.ReadAllText("template.txt");
templateFile = templateFile.Replace("@Name",n);
templateFile = templateFile.Replace("@Surname", s);
templateFile = templateFile.Replace("@Date", d);
templateFile = templateFile.Replace("@Buisness", nb);
templateFile = templateFile.Replace("@Position", p);
File.WriteAllText("Wizytowka.html", templateFile);
}
}
}
}