Analys av pdf filer i ladd katalogen för kontroll av deras affärsdatum
This commit is contained in:
20
StockHistory/frmStockHistoryInit.Designer.cs
generated
20
StockHistory/frmStockHistoryInit.Designer.cs
generated
@ -46,6 +46,7 @@
|
|||||||
btnClose = new Button();
|
btnClose = new Button();
|
||||||
btnNext = new Button();
|
btnNext = new Button();
|
||||||
btnDtaAnalyse1 = new Button();
|
btnDtaAnalyse1 = new Button();
|
||||||
|
btnListNoteDates = new Button();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// btnChooseFile
|
// btnChooseFile
|
||||||
@ -92,8 +93,10 @@
|
|||||||
txtFound.Margin = new Padding(3, 2, 3, 2);
|
txtFound.Margin = new Padding(3, 2, 3, 2);
|
||||||
txtFound.Multiline = true;
|
txtFound.Multiline = true;
|
||||||
txtFound.Name = "txtFound";
|
txtFound.Name = "txtFound";
|
||||||
|
txtFound.ScrollBars = ScrollBars.Both;
|
||||||
txtFound.Size = new Size(410, 228);
|
txtFound.Size = new Size(410, 228);
|
||||||
txtFound.TabIndex = 3;
|
txtFound.TabIndex = 3;
|
||||||
|
txtFound.WordWrap = false;
|
||||||
//
|
//
|
||||||
// btnSaveToDb
|
// btnSaveToDb
|
||||||
//
|
//
|
||||||
@ -122,7 +125,6 @@
|
|||||||
lwTransactions.TabIndex = 6;
|
lwTransactions.TabIndex = 6;
|
||||||
lwTransactions.UseCompatibleStateImageBehavior = false;
|
lwTransactions.UseCompatibleStateImageBehavior = false;
|
||||||
lwTransactions.View = View.Details;
|
lwTransactions.View = View.Details;
|
||||||
// lwTransactions.ColumnClick += lwTransactions_ColumnClick;
|
|
||||||
//
|
//
|
||||||
// StockCodeHeader
|
// StockCodeHeader
|
||||||
//
|
//
|
||||||
@ -208,12 +210,27 @@
|
|||||||
btnDtaAnalyse1.UseVisualStyleBackColor = false;
|
btnDtaAnalyse1.UseVisualStyleBackColor = false;
|
||||||
btnDtaAnalyse1.Click += btnDtaAnalyse1_Click;
|
btnDtaAnalyse1.Click += btnDtaAnalyse1_Click;
|
||||||
//
|
//
|
||||||
|
// btnListNoteDates
|
||||||
|
//
|
||||||
|
btnListNoteDates.BackColor = Color.FromArgb(128, 255, 128);
|
||||||
|
btnListNoteDates.FlatStyle = FlatStyle.Flat;
|
||||||
|
btnListNoteDates.Font = new Font("Segoe UI", 11F);
|
||||||
|
btnListNoteDates.Location = new Point(23, 56);
|
||||||
|
btnListNoteDates.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
btnListNoteDates.Name = "btnListNoteDates";
|
||||||
|
btnListNoteDates.Size = new Size(125, 28);
|
||||||
|
btnListNoteDates.TabIndex = 10;
|
||||||
|
btnListNoteDates.Text = "Note Datum";
|
||||||
|
btnListNoteDates.UseVisualStyleBackColor = false;
|
||||||
|
btnListNoteDates.Click += btnListNoteDates_Click;
|
||||||
|
//
|
||||||
// frmStockHistoryInit
|
// frmStockHistoryInit
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
BackColor = Color.LightGray;
|
BackColor = Color.LightGray;
|
||||||
ClientSize = new Size(1236, 423);
|
ClientSize = new Size(1236, 423);
|
||||||
|
Controls.Add(btnListNoteDates);
|
||||||
Controls.Add(btnDtaAnalyse1);
|
Controls.Add(btnDtaAnalyse1);
|
||||||
Controls.Add(btnNext);
|
Controls.Add(btnNext);
|
||||||
Controls.Add(btnClose);
|
Controls.Add(btnClose);
|
||||||
@ -250,5 +267,6 @@
|
|||||||
private Button btnClose;
|
private Button btnClose;
|
||||||
private Button btnNext;
|
private Button btnNext;
|
||||||
private Button btnDtaAnalyse1;
|
private Button btnDtaAnalyse1;
|
||||||
|
private Button btnListNoteDates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -304,6 +304,43 @@ public partial class frmStockHistoryInit : Form
|
|||||||
_analyseForm.Show();
|
_analyseForm.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnListNoteDates_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var directory = Path.GetDirectoryName(lblFileName.Text);
|
||||||
|
var files = Directory.GetFiles(directory, "*.pdf");
|
||||||
|
var PdfResult = string.Empty;
|
||||||
|
var tempStr = string.Empty;
|
||||||
|
txtFound.Text = string.Empty;
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
_pdfOpener.OpenPdf(file);
|
||||||
|
_pdfSidor = _pdfOpener.PdfSidor;
|
||||||
|
PdfResult = _pdfFormatter.ExtractFormattedTextUsingWords(_pdfSidor);
|
||||||
|
List<string> result = PdfResult.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||||
|
foreach (var line in result)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(line) && line.StartsWith("Affärsdag"))
|
||||||
|
{
|
||||||
|
|
||||||
|
tempStr += $" {line} -> {Path.GetFileName(file)} {Environment.NewLine}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
txtFound.Text = SortLines(tempStr);
|
||||||
|
txtFound.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
string SortLines(string input)
|
||||||
|
{
|
||||||
|
return string.Join(
|
||||||
|
Environment.NewLine,
|
||||||
|
input.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None)
|
||||||
|
.OrderBy(line => line)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user