Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need help with the template I can't figure out how to make horizontal and vertical lines #357

Open
GrigorevDanil opened this issue Jun 1, 2024 · 0 comments

Comments

@GrigorevDanil
Copy link

I apologize immediately, I am writing with a translator. I have such classes:

public class GiveDetail : IEntity, IEquatable
{
public int Id { get; set; }
public Give Give { get; set; }
public Product Product { get; set; }
public int? CountProduct { get; set; }
public bool IsSelected { get; set; }

public bool Equals(GiveDetail other) => Id == other.Id;

}

public class Product : IEntity, IEquatable
{
public int Id { get; set; }
public Category Category { get; set; }
public Brand Brand { get; set; }
public Unit Unit { get; set; }
public string Title { get; set; }
public string Model { get; set; }
public int? CountProduct { get; set; }
public int? Price { get; set; }
public string OKPD { get; set; }
public string? Description { get; set; }
public string TextProduct { get { return Title + " " + Model; } }
public bool IsSelected { get; set; }

public bool Equals(Product other) => Id == other.Id;

}

public class Give : IEntity, IEquatable
{
public int Id { get; set; }
public Employee Employee { get; set; }
public DateTime? DateGive { get; set; }
public string StringDateGive { get { return DateGive?.ToString("dd.MM.yyyy"); } }
public string TextGive { get { return Employee.Name[0] + "." + Employee.Lastname[0] + ". " + Employee.Surname + " " + DateGive?.ToString("dd.MM.yyyy"); } }
public bool IsSelected { get; set; }

public bool Equals(Give other) => Id == other.Id;

}

public class Employee : IEntity, IEquatable
{
public int Id { get; set; }
public Department Department { get; set; }
public Post Post { get; set; }
public string Surname { get; set; }
public string Name { get; set; }
public string? Lastname { get; set; }
public string? Email { get; set; }
public string NumPhone { get; set; }
public string Address { get; set; }
public string TextEmployee { get { return Surname + " " + Name + " " + Lastname; } }

public bool IsSelected { get; set; }

public bool Equals(Employee other) => Id == other.Id;

}

Вот так я заполняю элемент объекта

public IEnumerable IncomingProducts => Model.PublicIncommingProducts;

(string fileName, string pathSave) = (DialogService.ShowInput("Введите название документа"), DialogService.ShowBrowserCatalog());
if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(pathSave)) return;

var data = new
{
Day = dateProvide.Day,
Month = dateProvide.ToString("MMMM"),
Year = dateProvide.ToString("yy"),
NumPage = 2,
Company = TextStructureName,
Department = SelectedDepartment.Title,
MaterialPerson = SelectedMaterialPerson.TextEmployee,
Items = IncomingProducts
};

using (var template = new XLTemplate(pathPattern))
{

 template.AddVariable(data);
 template.Generate();

 template.SaveAs(path + "\\" + nameDocument + ".xlsx");

}

I get this error
image
here is my template
PatternMaterialStatement.xlsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant