LINQ Reporting Engine - Insert image document ODT

Inside an odt document I have a frame with a inside grid inside in a cell I have inserted another frame with the tag <<image [Util.qr(qrcode)]>>. The image is not inserted and my Util.qr function is not invoked. Why ? Thanks.

@samuele.lucarini

Could you please share your template, data, and code, so we could check the scenario on our end?

This is my code for insert generated QRCode Image :

 public class Util {
 
   private Util() {
     throw new IllegalStateException("Utility class");
   }
 
   private static final int BARCODE_RESOLUTION = 300;
 
  
 
   // QR CODE
 
   /** Generates a QR Code from a value. */
   public static byte[] qr(String value) throws IOException {
     return qr(value, false);
   }
 
   public static byte[] qr(String value, boolean caption) throws IOException {
     return qr(value, null, null, caption);
   }
 
   /**
    * Generates a QR Code from a value.
    *
    * @param version {@link QRVersion}
    */
   public static byte[] qr(String value, String version) throws IOException {
     return qr(value, version, false);
   }
 
   /**
    * Generates a QR Code from a value.
    *
    * @param version {@link QRVersion}
    * @param caption add value as caption below generated QrCode
    */
   public static byte[] qr(String value, String version, boolean caption) throws IOException {
     return qr(value, version, null, caption);
   }
 
   /**
    * Generates a QR Code from a value.
    *
    * @param version {@link QRVersion}
    * @param errorLevel {@link QRErrorLevel}
    */
   public static byte[] qr(String value, String version, String errorLevel) throws IOException {
     return qr(value, version, errorLevel, false);
   }
 
   /**
    * Generates a QR Code from a value.
    *
    * @param version {@link QRVersion}
    * @param errorLevel {@link QRErrorLevel}
    * @param caption add value as caption below generated QrCode
    */
   public static byte[] qr(String value, String version, String errorLevel, boolean caption)
       throws IOException {
 
     var qrVersion =
         version == null
             ? QRVersion.AUTO
             : switch (version) {
               case "01" -> QRVersion.VERSION_01;
               case "02" -> QRVersion.VERSION_02;
               case "03" -> QRVersion.VERSION_03;
               case "04" -> QRVersion.VERSION_04;
               case "05" -> QRVersion.VERSION_05;
               case "06" -> QRVersion.VERSION_06;
               case "07" -> QRVersion.VERSION_07;
               case "08" -> QRVersion.VERSION_08;
               case "09" -> QRVersion.VERSION_09;
               case "10" -> QRVersion.VERSION_10;
               case "11" -> QRVersion.VERSION_11;
               case "12" -> QRVersion.VERSION_12;
               case "13" -> QRVersion.VERSION_13;
               case "14" -> QRVersion.VERSION_14;
               case "15" -> QRVersion.VERSION_15;
               case "16" -> QRVersion.VERSION_16;
               case "17" -> QRVersion.VERSION_17;
               case "18" -> QRVersion.VERSION_18;
               case "19" -> QRVersion.VERSION_19;
               case "20" -> QRVersion.VERSION_20;
               case "21" -> QRVersion.VERSION_21;
               case "22" -> QRVersion.VERSION_22;
               case "23" -> QRVersion.VERSION_23;
               case "24" -> QRVersion.VERSION_24;
               case "25" -> QRVersion.VERSION_25;
               case "26" -> QRVersion.VERSION_26;
               case "27" -> QRVersion.VERSION_27;
               case "28" -> QRVersion.VERSION_28;
               case "29" -> QRVersion.VERSION_29;
               case "30" -> QRVersion.VERSION_30;
               case "31" -> QRVersion.VERSION_31;
               case "32" -> QRVersion.VERSION_32;
               case "33" -> QRVersion.VERSION_33;
               case "34" -> QRVersion.VERSION_34;
               case "35" -> QRVersion.VERSION_35;
               case "36" -> QRVersion.VERSION_36;
               case "37" -> QRVersion.VERSION_37;
               case "38" -> QRVersion.VERSION_38;
               case "39" -> QRVersion.VERSION_39;
               case "40" -> QRVersion.VERSION_40;
               case "M1" -> QRVersion.VERSION_M1;
               case "M2" -> QRVersion.VERSION_M2;
               case "M3" -> QRVersion.VERSION_M3;
               case "M4" -> QRVersion.VERSION_M4;
               default -> QRVersion.AUTO;
             };
 
     var qrErrorLevel =
         errorLevel == null
             ? null
             : switch (errorLevel) {
               case "L" -> QRErrorLevel.LEVEL_L;
               case "M" -> QRErrorLevel.LEVEL_M;
               case "Q" -> QRErrorLevel.LEVEL_Q;
               case "H" -> QRErrorLevel.LEVEL_H;
               default -> null;
             };
 
     return getQrCode(value, qrVersion, qrErrorLevel, null, caption);
   }
 
   
   private static byte[] getQrCode(
       String value,
       QRVersion version,
       QRErrorLevel errorLevel,
       Integer moduleWidthPixel,
       boolean caption)
       throws IOException {
     // Importante! QR Code lo gestisco con Aspose Barcode
     var bb = new BarcodeGenerator(EncodeTypes.QR, value);
 
     bb.getParameters().setResolution(BARCODE_RESOLUTION);
 
     // Settaggi specifici per QR CODE
     if (version != null) {
       bb.getParameters().getBarcode().getQR().setQrVersion(version);
     }
     if (errorLevel != null) {
       bb.getParameters().getBarcode().getQR().setQrErrorLevel(errorLevel);
     }
     if (moduleWidthPixel != null) {
       Unit xDimension = new Unit(moduleWidthPixel, GraphicsUnit.MILLIMETER);
       bb.getParameters().getBarcode().setXDimension(xDimension);
     }
 
     if (caption) {
       bb.getParameters().getBarcode().getCodeTextParameters().setLocation(CodeLocation.BELOW);
     } else {
       bb.getParameters().getBarcode().getCodeTextParameters().setLocation(CodeLocation.NONE);
     }
 
     try (var resultStream = new ByteArrayOutputStream()) {
       bb.save(resultStream, BarCodeImageFormat.SVG);
       return resultStream.toByteArray();
     }
   }
 }

Attach data.zip with (dati.xml and template.odt)data.zip (8.6 KB)

@samuele.lucarini

Microsoft Word is unable to load a textbox for your ODT template. I believe, there is a similar issue with Aspose.Words as it mimics Microsoft Word. WORDSNET-24776 is logged for the sake of further investigation. You will be notified through the forum thread, once we have any update on it.

is there another way to create a report with 3 columns and n rows without using the external frame present in the template?

Example
Item 1 Item 2 Item 3
Item 4 Item 5 Item 6
Item 7

@samuele.lucarini

Please check Template.zip (4.6 KB). It shows a basic idea. For more information, please check the following articles: