Compare commits
4 Commits
e1289aebbc
...
b68a2b2107
Author | SHA1 | Date | |
---|---|---|---|
b68a2b2107 | |||
2dd664df0a | |||
ded0520756 | |||
b18e573da4 |
@ -32,6 +32,6 @@ using Microsoft.Extensions.Configuration.UserSecrets;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.9.5.1")]
|
||||
[assembly: AssemblyFileVersion("1.9.5.1")]
|
||||
[assembly: AssemblyVersion("1.10.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.10.0.0")]
|
||||
[assembly: UserSecretsId("d4bb704e-14a5-421f-8f2d-0ffb66d090a2")]
|
||||
|
@ -8,6 +8,7 @@
|
||||
<Reference Path="Microsoft.Extensions.Caching.Memory.dll" Pack="true" />
|
||||
<Reference Path="Microsoft.Extensions.Configuration.Abstractions.dll" Pack="true" />
|
||||
<Reference Path="Microsoft.Extensions.Configuration.dll" Pack="true" />
|
||||
<Reference Path="Microsoft.Extensions.Configuration.EnvironmentVariables.dll" Pack="true" />
|
||||
<Reference Path="Microsoft.Extensions.Configuration.FileExtensions.dll" Pack="true" />
|
||||
<Reference Path="Microsoft.Extensions.Configuration.Json.dll" Pack="true" />
|
||||
<Reference Path="Microsoft.Extensions.Configuration.UserSecrets.dll" Pack="true" />
|
||||
|
@ -21,8 +21,9 @@
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||
<PackageReference Include="netDxf" Version="2022.11.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
|
@ -22,6 +22,7 @@ public class AddInConfiguration : IAddInConfiguration
|
||||
{
|
||||
_configuration = new ConfigurationBuilder()
|
||||
.AddUserSecrets<RhSolutionsAddIn>()
|
||||
.AddEnvironmentVariables("RHS_ADDIN__")
|
||||
.Build();
|
||||
|
||||
_rootKey = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\RhSolutions\RhSolutions-AddIn");
|
||||
|
@ -2,6 +2,7 @@ using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace RhSolutions.Services;
|
||||
@ -36,8 +37,8 @@ public class YandexOcrClient : IOcrClient
|
||||
_httpClient.DefaultRequestHeaders.Add("x-data-logging-enable", "true");
|
||||
|
||||
using HttpResponseMessage response = await _httpClient.PostAsync("recognizeText", jsonContent);
|
||||
response.EnsureSuccessStatusCode();
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string jsonResponse = await response.Content.ReadAsStringAsync();
|
||||
OcrResponse deserialized = JsonConvert.DeserializeObject<OcrResponse>(jsonResponse);
|
||||
|
||||
@ -69,6 +70,13 @@ public class YandexOcrClient : IOcrClient
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string content = await response.Content.ReadAsStringAsync();
|
||||
MessageBox.Show($"{response.StatusCode}: {content}", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
return Enumerable.Empty<object[,]>();
|
||||
}
|
||||
}
|
@ -56,9 +56,17 @@ internal class OcrTool : ITool
|
||||
Range excelCell = app.ActiveSheet.Cells(currentCell.Row + row,
|
||||
currentCell.Column + column);
|
||||
excelCell.Value2 = table[row, column];
|
||||
excelCell.EntireColumn.AutoFit();
|
||||
excelCell.EntireRow.AutoFit();
|
||||
}
|
||||
|
||||
foreach (Range row in tableRange.Rows)
|
||||
{
|
||||
row.EntireRow.AutoFit();
|
||||
}
|
||||
foreach (Range column in tableRange.Columns)
|
||||
{
|
||||
column.EntireColumn.AutoFit();
|
||||
}
|
||||
|
||||
app.ActiveSheet.Cells(currentCell.Row + rowCount + 1, currentCell.Column).Activate();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user