Hello, I use
Nested Mail merge for group.
Wen a group is null I get the following message: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
Example: If one CultureAdvice has no DosageApplication error occurs
Query
var CultureVisit = await _repositoryCultureVisit.Entities.Where(cv => cv.Id == query.Id)
.Include(ca => ca.CultureAdvices).ThenInclude(p => p.Product).ThenInclude(s => s.SaleUnit)
.Include(ca => ca.CultureAdvices).ThenInclude(da => da.DosageApplication)
Word
«TableStart:CultureAdvices»«Advice»
«TableStart:DosageApplication»«Target»«TableEnd:DosageApplication»
«TableStart:Product»«Name»«TableEnd:Product»
«TableEnd:CultureAdvices»
....
document.MailMerge.RemoveEmptyGroup = true;
document.MailMerge.RemoveEmptyParagraphs = true;