избранное, выгрузка

This commit is contained in:
2021-07-01 14:13:22 +05:00
parent a6d9abcedd
commit 5d710d3cf1
26 changed files with 145 additions and 9 deletions
+11 -7
View File
@@ -12,12 +12,16 @@ public class Onejsky4U : ModuleRules
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
// Add any import libraries or static libraries
//Type = ModuleType.External;
//PublicAdditionalLibraries.Add(Path.Combine(ModuleDirectory, "D:\Projects\Onejsky\libxl-3.9.4.3\lib64", "libxl.lib"));
PublicAdditionalLibraries.Add("D:\\Projects\\Onejsky\\libxl-3.9.4.3\\lib64\\libxl.lib");
}
}
+124 -1
View File
@@ -1,7 +1,9 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "Onejsky4UGameModeBase.h"
//#define WIN32_LEAN_AND_MEAN
//#include <windows.h>
//#include "..\..\Libraries\libxl-3.9.4.3\include_cpp\libxl.h"
void AOnejsky4UGameModeBase::CreateTxt(FString Path, FString FileName, FString text)
@@ -13,3 +15,124 @@ void AOnejsky4UGameModeBase::CreateTxt(FString Path, FString FileName, FString t
FFileHelper::SaveStringToFile(text, *fullpath, FFileHelper::EEncodingOptions::ForceUTF8);
}
bool AOnejsky4UGameModeBase::AppendStringToFile(FString DirPath, FString FileName, FString Data)
{
// get file path
FString FilePath;
if (!DirPath.Len())
{
// default documents directory path + FileName
FilePath = FPlatformProcess::UserDir() + FileName;
}
else
{
FilePath = DirPath + FileName;
}
UE_LOG(LogTemp, Log, TEXT("File path: %s"), *FilePath);
// check file existence and write data to a file
FString OldData;
bool append_result;
if (FPaths::FileExists(FilePath))
{
UE_LOG(LogTemp, Log, TEXT("File exists: true"));
FFileHelper::LoadFileToString(OldData, *FilePath);
OldData += Data;
append_result = FFileHelper::SaveStringToFile(Data, *FilePath, FFileHelper::EEncodingOptions::ForceUTF8, &IFileManager::Get(), FILEWRITE_Append);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("File exists: false"));
append_result = FFileHelper::SaveStringToFile(Data, *FilePath, FFileHelper::EEncodingOptions::ForceUTF8);
}
// return append result
if (append_result)
{
UE_LOG(LogTemp, Log, TEXT("Append: complete"));
return true;
}
else
{
UE_LOG(LogTemp, Error, TEXT("Append: not complete"));
return false;
}
}
void AOnejsky4UGameModeBase::RunSystemCommand(FString Command)
{
system(TCHAR_TO_ANSI(*Command));
}
void AOnejsky4UGameModeBase::GetExcelData(FString Command)
{
/*using namespace libxl;
Book* book = xlCreateXMLBook();
if (!book)
return;
Font* boldFont = book->addFont();
boldFont->setBold();
Font* titleFont = book->addFont();
titleFont->setName(L"Arial Black");
titleFont->setSize(16);
Format* titleFormat = book->addFormat();
titleFormat->setFont(titleFont);
Format* headerFormat = book->addFormat();
headerFormat->setAlignH(ALIGNH_CENTER);
headerFormat->setBorder(BORDERSTYLE_THIN);
headerFormat->setFont(boldFont);
headerFormat->setFillPattern(FILLPATTERN_SOLID);
headerFormat->setPatternForegroundColor(libxl::Color::COLOR_YELLOW);
Format* descriptionFormat = book->addFormat();
descriptionFormat->setBorderLeft(BORDERSTYLE_THIN);
Format* amountFormat = book->addFormat();
amountFormat->setNumFormat(NUMFORMAT_CURRENCY_NEGBRA);
amountFormat->setBorderLeft(BORDERSTYLE_THIN);
amountFormat->setBorderRight(BORDERSTYLE_THIN);
Format* totalLabelFormat = book->addFormat();
totalLabelFormat->setBorderTop(BORDERSTYLE_THIN);
totalLabelFormat->setAlignH(ALIGNH_RIGHT);
totalLabelFormat->setFont(boldFont);
Format* totalFormat = book->addFormat();
totalFormat->setNumFormat(NUMFORMAT_CURRENCY_NEGBRA);
totalFormat->setBorder(BORDERSTYLE_THIN);
totalFormat->setFont(boldFont);
totalFormat->setFillPattern(FILLPATTERN_SOLID);
totalFormat->setPatternForegroundColor(libxl::Color::COLOR_YELLOW);
Format* signatureFormat = book->addFormat();
signatureFormat->setAlignH(ALIGNH_CENTER);
signatureFormat->setBorderTop(BORDERSTYLE_THIN);
Sheet* sheet = book->addSheet(L"Invoice");
if (!sheet)
return;
sheet->writeStr(1, 1, L"ïîëíîå_èìÿ", headerFormat);
//sheet->writeStr(1, 2, L"òåëåôîí", headerFormat);
//sheet->writeStr(1, 3, L"ïî÷òà", headerFormat);
//sheet->writeStr(1, 4, L"âðåìÿ_ñåàíñà", headerFormat);
//sheet->writeStr(1, 5, L"çàðåçåðâèðîâàííûå", headerFormat);
//sheet->writeStr(1, 6, L"èçáðàííûå", headerFormat);
//sheet->writeStr(1, 7, L"ïðîñìîòðåííûå", headerFormat);
sheet->setCol(1, 1, 35.0f);
sheet->setCol(1, 2, 35.0f);
sheet->setCol(1, 3, 35.0f);
sheet->setCol(1, 4, 35.0f);
sheet->setCol(1, 5, 35.0f);
sheet->setCol(1, 6, 35.0f);
sheet->setCol(1, 7, 35.0f);
if (book->save(L"invoice.xlsx"))
book->release();*/
}
+10 -1
View File
@@ -22,6 +22,15 @@ class ONEJSKY4U_API AOnejsky4UGameModeBase : public AGameModeBase
public:
UFUNCTION(BlueprintCallable, Category = "TextMaker")
static void CreateTxt(FString Path, FString FileName, FString text);
static void CreateTxt(FString Path, FString FileName, FString text);
UFUNCTION(BlueprintCallable, Category = "File")
static bool AppendStringToFile(FString DirPath, FString FileName, FString Data);
UFUNCTION(BlueprintCallable, Category = "System")
static void RunSystemCommand(FString Command);
UFUNCTION(BlueprintCallable, Category = "System")
static void GetExcelData(FString Command);
};