2017-04-14 114 views

回答

1

我無法找到在水晶報表或VB中生成QR碼的原生方式,但我確實找到了將圖像鏈接到生成QR碼的Google API的方法。

要使用:

  1. 插入圖形報告。
  2. 右鍵點擊圖片並點擊「格式化圖片」。
  3. 點擊「圖片標籤」。
  4. 單擊圖形位置旁邊的公式編輯按鈕。
  5. 添加此代碼或使用此代碼引用一個公式。
  6. 根據需要編輯變量。

    //-------------------------- 
    // QR Code Gererator 
    // 
    // Uses Google's Chart API. 
    // 
    // To Use: 
    // Insert a graphic to the 
    // report. Right click 
    // on it and click "Format 
    // graphic". Click on the 
    // "Picture Tab". Click 
    // on the formula edit 
    // button next to graphic 
    // location. Add this code 
    // or reference a formula 
    // with this code in it. 
    // 
    // You can update the width 
    // height and encoding below. 
    // 
    // For more info see 
    // https://developers.google.com/chart/infographics/docs/qr_codes?csw=1 
    // 
    // Feel free to redistribute. 
    // 
    // @Author Daniel Havens 
    // @Created 2018-02-01 
    stringVar QRFormat; 
    stringVar QRwidth; 
    stringVar QRheight; 
    stringVar QRText; 
    stringVar QRURI; 
    
    // Encoding format see google's api 
    QRFormat := 'UTF-8'; 
    
    // Width in Pixels 
    QRwidth := '325'; 
    
    // Height in Pixels 
    QRheight := '325'; 
    
    // Text for the QR Code. 
    // 
    // 
    QRText := 'http://stackoverflow.com/'; 
    
    // To Do: 
    // StringReplace for URI 
    
    // Combine the result 
    // 
    // Base URI must be http:// 
    // or Crystal cannot fetch 
    // the image 
    QRURI := 'http://chart.googleapis.com/chart?cht=qr&choe='+QRFormat+'&chs='+QRWidth+'x'+QRHeight+'&chl='+QRText; 
    
    QRURI;