Hello Guys,
I am getting Error when using RAD Power Tools (2.2.0.4) to generate new Entity : 'EpPlus' does not exist in the namespace 'xxx.DataExporting.Excel' (are you missing an assembly reference?) xxx.Application
Apsnet Zero .net Core MVC v.8.4
7 Answer(s)
-
0
hi josejunior
We will solve it as soon as possible, you can temporarily replace EPPLUS with NPOI according to PR https://github.com/aspnetzero/aspnet-zero-core/pull/3057
Please follow: https://github.com/aspnetzero/aspnet-zero-core/issues/3089
-
0
Hi, ASPNetZero Guys...
I am getting the same error as JoseJunior...
I tried to use the two links referenced by maliming, but I got 404 error for both...
I am using .Net Core 3.1, + Angular 8.4 + RADTool 2.2.0.4
Thanks a lot,
Javier Carreño From Bogota, Colombia
-
0
Hi Javier,
Go to {your project name} \AspNetZeroRadTool\FileTemplates\Server\ExportAppServiceClass\ and copy the file MainTemplate.txt to the filename MainTemplate.custom.txt. Now open that file and make it refelect this:
using System.Collections.Generic; using Abp.Runtime.Session; using Abp.Timing.Timezone; using {{Namespace_Here}}.DataExporting.Excel.NPOI; using {{Namespace_Here}}.{{Namespace_Relative_Full_Here}}.Dtos; using {{Namespace_Here}}.Dto; using {{Namespace_Here}}.Storage;
namespace {{Namespace_Here}}.{{Namespace_Relative_Full_Here}}.Exporting { public class {{Entity_Name_Plural_Here}}ExcelExporter : NpoiExcelExporterBase, I{{Entity_Name_Plural_Here}}ExcelExporter {
private readonly ITimeZoneConverter _timeZoneConverter; private readonly IAbpSession _abpSession; public {{Entity_Name_Plural_Here}}ExcelExporter( ITimeZoneConverter timeZoneConverter, IAbpSession abpSession, ITempFileCacheManager tempFileCacheManager) : base(tempFileCacheManager) { _timeZoneConverter = timeZoneConverter; _abpSession = abpSession; } public FileDto ExportToFile(List<Get{{Entity_Name_Here}}ForViewDto> {{entity_Name_Plural_Here}}) { return CreateExcelPackage( "{{Entity_Name_Plural_Here}}.xlsx", excelPackage => { var sheet = excelPackage.CreateSheet(L("{{Entity_Name_Plural_Here}}")); AddHeader( sheet{{Property_Header_Here}}{{NP_Header_Here}} ); AddObjects( sheet, 2, {{entity_Name_Plural_Here}}{{Property_Params_Here}}{{NP_Params_Here}} ); {{Property_DateTime_Formatter_Here}} }); } }
}
Save the file and to {your project name} \AspNetZeroRadTool\FileTemplates\Server\ExportAppServiceClass\MainTemplate.custom.txt and go back and regenerate your files and they will work.
For completeness I changed:
using {{Namespace_Here}}.DataExporting.Excel.EpPlus; Change to using {{Namespace_Here}}.DataExporting.Excel.NPOI;
var sheet = excelPackage.Workbook.Worksheets.Add(L("{{Entity_Name_Plural_Here}}")); changed to var sheet = excelPackage.CreateSheet(L("{{Entity_Name_Plural_Here}}"));
Then remove line sheet.OutLineApplyStyle = true;
The code above is the compled version.
Howie
-
0
Hi, hamberg...
Thanks a lot... Already I edited one entity to use npoi and I compiled without error, but your response resolved the issue for all new entities...
Again, Thanks,
Javier Carreño From Bogota, Colombia
-
0
Thanks @hamberg,
Let's keep this open until we release the fix.
-
0
Hi, @ismcagdas and @hamberg...
After generate some entities using RAD Tool, all works fine... BUT.... if the entity have one o more DateTime properties, the section [Property_DateTime_Formatter_Here] of the template is translated to:
var PropertyColumn = sheet.Column(3); PropertyColumn.Style.Numberformat.Format = "yyyy-mm-dd"; PropertyColumn.AutoFit();
and the sheet object on npio does not have any property "Column"... because in npio exists rows and cells, but not exists "columns"...
So, the template must be fixed including this last issue...
Thanks a lot,
Javier Carreño From Bogotá, Colombia
-
0
Hi,
This problem should be fixed today. Could you try with the latest version of AspNet Zero Power Tools ?
Thanks,