Leading whitespace when using LINQ Reporting Engine and doc-tag with inline-switch

The target template contains the string <<doc [document] -inline>><<doc [document] -inline>>, and the source file only contains the word “replacement”. I would expect the Reporting Engine to output “replacementreplacement” as a result. However, it actually outputs “replacement replacement”. A whitespace is being inserted if there is text before the doc tag. My question would be how to prevent the insertion of a whitespace?

public static void TestMethod()
{
    var targetDocumentBuilder = new DocumentBuilder();
    targetDocumentBuilder.Write("<<doc [document] -inline>><<doc [document] -inline>>");
    var sourceDocumentBuilder = new DocumentBuilder();
    sourceDocumentBuilder.Write("replacement");
    new ReportingEngine().BuildReport(targetDocumentBuilder.Document, sourceDocumentBuilder.Document, "document");
}

@kvaak

LINQ Reporting Engine mimics MS Word behavior while inserting a document. MS Word adds a whitespace in such a situation, so does the engine. So, I am afraid, this is an expected behavior.

A quick workaround for this could be adding a whitespace between the two doc tags manually (then the engine should not add yet another one) and making the font of this whitespace hidden. Then, visually, the result should be as expected.

1 Like

@ivan.lyagin
Thank you very much for the very quick response. If it represents the intended behavior, the solution with the font is perfectly sufficient for me. Thank you for the assistance, and have a great weekend.

1 Like