nnan införande av csv-rapport från avanza

This commit is contained in:
2026-04-29 09:10:32 +02:00
parent 3ec543ed3d
commit fdf3c86bd0
3 changed files with 56 additions and 5 deletions

View File

@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StockHistory", "StockHistory.csproj", "{2741BE75-958D-75E1-0B33-DDB7A4F4ECC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2741BE75-958D-75E1-0B33-DDB7A4F4ECC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2741BE75-958D-75E1-0B33-DDB7A4F4ECC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2741BE75-958D-75E1-0B33-DDB7A4F4ECC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2741BE75-958D-75E1-0B33-DDB7A4F4ECC3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0589A6E0-1BDE-40FF-97AC-77444B3CED24}
EndGlobalSection
EndGlobal

View File

@ -114,7 +114,7 @@
lwTransactions.Location = new Point(515, 27);
lwTransactions.Name = "lwTransactions";
lwTransactions.Size = new Size(857, 456);
lwTransactions.Sorting = SortOrder.Descending;
lwTransactions.Sorting = SortOrder.Ascending;
lwTransactions.TabIndex = 6;
lwTransactions.UseCompatibleStateImageBehavior = false;
lwTransactions.View = View.Details;

View File

@ -73,10 +73,10 @@ public partial class frmStockHistoryInit : Form
private void btnAnalysera_Click(object sender, EventArgs e)
{
string PdfResult=string.Empty;
if (lblFileName.Text.ToLower().Contains("avanza"))
{
//var Result = PdfPigLetterExtractor.ExtractLines(_pdfSidor);
//SelectPdfLetterData(Result);
if (lblFileName.Text.ToLower().EndsWith("csv"))
{
var Result = string.Empty; //DocoticPdfReading.ExtractText(lblFileName.Text);
SelectAvanzaPdfData(Result);
}
else
{
@ -87,6 +87,33 @@ public partial class frmStockHistoryInit : Form
lblFileName.Text = string.Empty;
}
private void SelectAvanzaPdfData(string PdfResult)
{
txtFound.Text = string.Empty;
List<string> result = PdfResult.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();
//List<string> selected = new();
foreach (var line in result)
{
if (!string.IsNullOrWhiteSpace(line) && line.StartsWith("Affärsdag")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Handelstidpunkt")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Värdepapper")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Kurs")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Genomsnittlig")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Antal")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Köpeskilling")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Courtage")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Belopp")
|| !string.IsNullOrWhiteSpace(line) && line.StartsWith("Vi bekräftar")
)
{
Selected.Add(line);
txtFound.Text += line + Environment.NewLine;
txtFound.Refresh();
}
}
}
private void SelectPdfData(string PdfResult)
{