private void btnLerArquivo_Click(object sender, EventArgs e) { var filePath = textBox1.Text; if (!File.Exists(filePath)) { MessageHelper.ShowWarning("File does not exist"); return; } if (!Path.GetExtension(filePath).IsInList(".po", ".xlsx")) { MessageHelper.ShowWarning("File extension not recognized"); return; } try { var file = PoSheetReader.Read(filePath); _currentFile = file; dataGridView1.DataSource = file.Records; MessageHelper.ShowInfo("Leitura concluída"); } catch (Exception ex) { MessageHelper.ShowError("Erro ao ler o arquivo: " + ex.Message); } }
static void Main(string[] args) { try { var sheet = PoSheetReader.Read(@"C:\Users\Wellington\Downloads\Pasta de trabalho.xlsx"); // var file = PoFileReader.Read(@"C:\Users\Wellington\Downloads\messages.po"); PoFileWriter.Override(@"C:\Users\Wellington\Downloads\messages.po", sheet); MessageHelper.ShowInfo("Operação concluída"); } catch (System.Exception ex) { MessageHelper.ShowError(ex.Message); } finally { Console.Read(); } }