Jump to content
uniGUI Discussion Forums

SMARAM

uniGUI Subscriber
  • Content Count

    29
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by SMARAM

  1. SMARAM

    uniGUI update and cache

    Hi Mika, I just updated my Unigui version to Ext 6.5 and was having some problems too. Maybe this post can help you. But when you update ext4 to ext6, you may have some problems with javascript like "sender.addClass" that changed to "sender.addCls". So I created a converter to change inside my dfm based on files "DE.txt" and "PARA.txt". The converter was necessary since dfm has string truncated inside. Conversor_EXTJS4_EXTJS6.zip
  2. SMARAM

    Erase Cached CSS

    Hi, is there a way to force the cached CSS to update? I would like to create something that when user log on my application, the application reload the cached css without manually pressing Ctrl+F5. Best regards.
  3. SMARAM

    Erase Cached CSS

    I found a solution that I found on another topic. The files are different since my version (Ext 6.5). 1) On directory ext\build\classic, copy directory theme "theme-neptune" (that's my custom theme) as "theme-neptune2" for example. 2) Inside this directory, rename file "theme-neptune.js" to "theme-neptune2.js" 3) Inside directory ext\build\classic\theme-neptune2\resources, rename file "theme-neptune-all.css" to "theme-neptune2-all.css" 4) On your project, go to MainModule and change property Theme to "neptune2" That's all. No need to tell your users to delete cache on browser.
  4. For people who is having problems with download the zip file. UExportExcel.pas //============================================================================= // TDataSet to Excel without OLE or Excel required // Mike Heydon Dec 2002 // Adapted to Unigui with TUniDBGrid // Mauricio Naozuka - 26/04/2018 - naozuka@gmail.com //============================================================================= unit UExportExcel; // Example // // Add uses UExportExcel // //procedure TMainForm.UniButton1Click(Sender: TObject); //var url, filename, reportname : String; // exportExcel: TDataSetToExcel; // i: integer; //begin // reportname := 'ExcelReport'; // url := UniServerModule.LocalCacheURL+name+'.xls'; // filename := UniServerModule.NewCacheFileUrl(false, 'xls', reportname, '', url); // // exportExcel := TDataSetToExcel.Create; // exportExcel.WriteFile(filename, UniDBGrid1); // FreeAndNil(exportExcel); // UniSession.SendFile(filename, reportname+'.xls'); //end; interface uses Windows, SysUtils, DB, Math, uniBasicGrid, uniDBGrid; type // TDataSetToExcel TDataSetToExcel = class(TObject) protected procedure WriteToken(AToken: word; ALength: word); procedure WriteFont(const AFontName: Ansistring; AFontHeight, AAttribute: word); procedure WriteFormat(const AFormatStr: Ansistring); private FRow: word; FFieldCount: integer; FDataFile: file; FFileName: string; public constructor Create; function WriteFile(const AFileName: string; const AGrid: TUniDBGrid): boolean; end; //----------------------------------------------------------------------------- implementation const // XL Tokens XL_DIM = $00; XL_BOF = $09; XL_EOF = $0A; XL_DOCUMENT = $10; XL_FORMAT = $1E; XL_COLWIDTH = $24; XL_FONT = $31; // XL Cell Types XL_INTEGER = $02; XL_DOUBLE = $03; XL_STRING = $04; // XL Cell Formats XL_INTFORMAT = $81; XL_DBLFORMAT = $82; XL_XDTFORMAT = $83; XL_DTEFORMAT = $84; XL_TMEFORMAT = $85; XL_HEADBOLD = $40; XL_HEADSHADE = $F8; // ======================== // Create the class // ======================== constructor TDataSetToExcel.Create; begin FFieldCount := 0; end; // ==================================== // Write a Token Descripton Header // ==================================== procedure TDataSetToExcel.WriteToken(AToken: word; ALength: word); var aTOKBuffer: array[0..1] of word; begin aTOKBuffer[0] := AToken; aTOKBuffer[1] := ALength; Blockwrite(FDataFile, aTOKBuffer, SizeOf(aTOKBuffer)); end; // ==================================== // Write the font information // ==================================== procedure TDataSetToExcel.WriteFont(const AFontName: ansistring; AFontHeight, AAttribute: word); var iLen: byte; begin AFontHeight := AFontHeight * 20; WriteToken(XL_FONT, 5 + length(AFontName)); BlockWrite(FDataFile, AFontHeight, 2); BlockWrite(FDataFile, AAttribute, 2); iLen := length(AFontName); BlockWrite(FDataFile, iLen, 1); BlockWrite(FDataFile, AFontName[1], iLen); end; // ==================================== // Write the format information // ==================================== procedure TDataSetToExcel.WriteFormat(const AFormatStr: ansistring); var iLen: byte; begin WriteToken(XL_FORMAT, 1 + length(AFormatStr)); iLen := length(AFormatStr); BlockWrite(FDataFile, iLen, 1); BlockWrite(FDataFile, AFormatStr[1], iLen); end; // ==================================== // Write the XL file from data set // ==================================== function TDataSetToExcel.WriteFile(const AFilename:String; const AGrid: TUniDBGrid): boolean; var bRetvar: boolean; aDOCBuffer: array[0..1] of word; aDIMBuffer: array[0..3] of word; aAttributes: array[0..2] of byte; i: integer; iColNum, iDataLen: byte; sStrData: string; fDblData: double; wWidth: word; sStrBytes: TBytes; begin if not Assigned(AGrid) then raise Exception.Create('There is no Grid is vinculated.'); if not Assigned(AGrid.DataSource) then raise Exception.Create('There is no DataSource is vinculated to Grid ' + AGrid.Name); if not Assigned(AGrid.DataSource.DataSet) then raise Exception.Create('There is no DataSet is vinculated to DataSource ' + AGrid.DataSource.Name); bRetvar := true; FRow := 0; FillChar(aAttributes, SizeOf(aAttributes), 0); FFileName := ChangeFileExt(AFilename, '.xls'); AssignFile(FDataFile, FFileName); try Rewrite(FDataFile, 1); // Beginning of File WriteToken(XL_BOF, 4); aDOCBuffer[0] := 0; aDOCBuffer[1] := XL_DOCUMENT; Blockwrite(FDataFile, aDOCBuffer, SizeOf(aDOCBuffer)); // Font Table WriteFont('Arial', 10, 0); WriteFont('Arial', 10, 1); //WriteFont('Courier New', 11, 0); // Column widths iColNum := 0; for i := 0 to AGrid.Columns.Count-1 do begin if not AGrid.Columns[i].Visible then continue; if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DisplayWidth + 1 > Length(AGrid.Columns[i].Title.Caption) then begin wWidth := (AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DisplayWidth + 1) * 256; end else begin wWidth := (Length(AGrid.Columns[i].Title.Caption) + 1) * 256; end; // Limitar o tamanho da coluna if wWidth > 80*256 then wWidth := 80*256; // if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType = ftDateTime then // inc(wWidth, 100); // if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType = ftDate then // inc(wWidth, 1050); // if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType = ftTime then // inc(wWidth, 100); WriteToken(XL_COLWIDTH, 4); BlockWrite(FDataFile, iColNum, 1); BlockWrite(FDataFile, iColNum, 1); BlockWrite(FDataFile, wWidth, 2); Inc(iColNum); end; FFieldCount := iColNum; // Column Formats WriteFormat('Geral'); WriteFormat('0'); WriteFormat('#.##0,0000'); WriteFormat('dd/mm/aaaa hh:mm:ss'); WriteFormat('dd/mm/aaaa'); WriteFormat('hh:mm:ss'); // Dimensions WriteToken(XL_DIM, 8); aDIMBuffer[0] := 0; aDIMBuffer[1] := Min(AGrid.DataSource.DataSet.RecordCount, $FFFF); aDIMBuffer[2] := 0; aDIMBuffer[3] := Min(FFieldCount - 1, $FFFF); Blockwrite(FDataFile, aDIMBuffer, SizeOf(aDIMBuffer)); // Column Headers iColNum := 0; for i := 0 to AGrid.Columns.Count-1 do begin if not AGrid.Columns[i].Visible then continue; // sStrData := FDataSet.Fields[i].DisplayName; sStrBytes := TEncoding.ANSI.GetBytes(AGrid.Columns[i].Title.Caption); iDataLen := length(sStrBytes); WriteToken(XL_STRING, iDataLen + 8); WriteToken(FRow, iColNum); aAttributes[1] := XL_HEADBOLD; //aAttributes[2] := XL_HEADSHADE; BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes)); BlockWrite(FDataFile, iDataLen, SizeOf(iDataLen)); if iDataLen > 0 then BlockWrite(FDataFile, sStrBytes[0], iDataLen); aAttributes[2] := 0; Inc(iColNum); end; try AGrid.DataSource.DataSet.DisableControls; AGrid.DataSource.DataSet.First; // Data Rows while not AGrid.DataSource.DataSet.Eof do begin inc(FRow); iColNum := 0; for i := 0 to AGrid.Columns.Count-1 do begin if not AGrid.Columns[i].Visible then continue; case AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType of ftBoolean, ftWideString, ftFixedChar, ftString: begin try // sStrData := FDataSet.Fields[i].AsString; sStrBytes:=TEncoding.ANSI.GetBytes(AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsString); iDataLen := length(sStrBytes); WriteToken(XL_STRING, iDataLen + 8); WriteToken(FRow, iColNum); aAttributes[1] := 0; BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes)); BlockWrite(FDataFile, iDataLen, SizeOf(iDataLen)); if iDataLen > 0 then BlockWrite(FDataFile, sStrBytes[0], iDataLen); except on E: Exception do //ShowMessage(E.Message); raise Exception.Create('Erro Converter: ' + E.Message); end; end; ftAutoInc, ftSmallInt, ftInteger, ftWord, ftLargeInt: begin try fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat; iDataLen := SizeOf(fDblData); WriteToken(XL_DOUBLE, 15); WriteToken(FRow, iColNum); aAttributes[1] := XL_INTFORMAT; BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes)); BlockWrite(FDataFile, fDblData, iDatalen); except on E: Exception do //ShowMessage(E.Message); raise Exception.Create('Erro Converter Inteiro: ' + E.Message); end; end; ftFloat, ftCurrency, ftBcd, ftFMTBcd: begin try fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat; iDataLen := SizeOf(fDblData); WriteToken(XL_DOUBLE, 15); WriteToken(FRow, iColNum); aAttributes[1] := XL_DBLFORMAT; BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes)); BlockWrite(FDataFile, fDblData, iDatalen); except on E: Exception do //ShowMessage(E.Message); raise Exception.Create('Erro Converter Float: ' + E.Message); end; end; ftDateTime: begin try if not AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).IsNull then begin fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat; iDataLen := SizeOf(fDblData); WriteToken(XL_DOUBLE, 15); WriteToken(FRow, iColNum); aAttributes[1] := XL_XDTFORMAT; BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes)); BlockWrite(FDataFile, fDblData, iDatalen); end; except on E: Exception do //ShowMessage(E.Message); raise Exception.Create('Erro Converter DateTime: ' + E.Message); end; end; ftDate: begin try if not AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).IsNull then begin fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat; iDataLen := SizeOf(fDblData); WriteToken(XL_DOUBLE, 15); WriteToken(FRow, iColNum); aAttributes[1] := XL_DTEFORMAT; BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes)); BlockWrite(FDataFile, fDblData, iDatalen); end; except on E: Exception do //ShowMessage(E.Message); raise Exception.Create('Erro Converter Date: ' + E.Message); end; end; ftTime: begin try if not AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).IsNull then begin fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat; iDataLen := SizeOf(fDblData); WriteToken(XL_DOUBLE, 15); WriteToken(FRow, iColNum); aAttributes[1] := XL_TMEFORMAT; BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes)); BlockWrite(FDataFile, fDblData, iDatalen); end; except on E: Exception do //ShowMessage(E.Message); raise Exception.Create('Erro Converter Time: ' + E.Message); end; end; ftMemo: begin // Does not print memo end; else raise Exception.Create('Tipo [' + AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).ClassName + '] do campo [' + AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).FieldName + '] não foi tratado.'); end; Inc(iColNum); end; // end of for AGrid.DataSource.DataSet.Next; end; // end of while finally AGrid.DataSource.DataSet.EnableControls; AGrid.DataSource.DataSet.First; end; // End of File WriteToken(XL_EOF, 0); CloseFile(FDataFile); except bRetvar := false; end; Result := bRetvar; end; end.
  5. Hi, As the title says, I converted a library that Mike Heydon made to export a DataSet to old format Excel file (xls) without OLE or Excel installed. This library now converts an UniDBGrid to Excel. Sample of usage. // Add uses UExportExcel procedure TMainForm.UniButton1Click(Sender: TObject); var url, filename, reportname : String; exportExcel: TDataSetToExcel; i: integer; begin reportname := 'ExcelReport'; url := UniServerModule.LocalCacheURL+name+'.xls'; filename := UniServerModule.NewCacheFileUrl(false, 'xls', reportname, '', url); exportExcel := TDataSetToExcel.Create(filename); exportExcel.Grid := UniDBGrid1; exportExcel.WriteFile; FreeAndNil(exportExcel); UniSession.SendFile(filename, reportname+'.xls'); end; Hope it helps everyone. UExportExcel.zip
  6. //=============================================================================
    // TDataSet to Excel without OLE or Excel required
    // Mike Heydon Dec 2002
    
    // Adapted to Unigui with TUniDBGrid
    // Mauricio Naozuka - 26/04/2018 - naozuka@gmail.com
    //=============================================================================
    
    unit UExportExcel;
    
    //  Example
    //
    //  Add uses UExportExcel
    //
    //procedure TMainForm.UniButton1Click(Sender: TObject);
    //var url, filename, reportname : String;
    //    exportExcel: TDataSetToExcel;
    //    i: integer;
    //begin
    //	reportname := 'ExcelReport';
    //	url := UniServerModule.LocalCacheURL+name+'.xls';
    //	filename := UniServerModule.NewCacheFileUrl(false, 'xls', reportname, '', url);
    //
    //	exportExcel := TDataSetToExcel.Create;
    //  exportExcel.WriteFile(filename, UniDBGrid1);
    //  FreeAndNil(exportExcel);
    //  UniSession.SendFile(filename, reportname+'.xls');
    //end;
    
    interface
    
    uses Windows, SysUtils, DB, Math, uniBasicGrid, uniDBGrid;
    
    type
      // TDataSetToExcel
      TDataSetToExcel = class(TObject)
      protected
        procedure WriteToken(AToken: word; ALength: word);
        procedure WriteFont(const AFontName: Ansistring; AFontHeight,
          AAttribute: word);
        procedure WriteFormat(const AFormatStr: Ansistring);
      private
        FRow: word;
        FFieldCount: integer;
        FDataFile: file;
        FFileName: string;
      public
        constructor Create;
        function WriteFile(const AFileName: string; const AGrid: TUniDBGrid): boolean;
      end;
    
    //-----------------------------------------------------------------------------
    implementation
    
    const
      // XL Tokens
      XL_DIM = $00;
      XL_BOF = $09;
      XL_EOF = $0A;
      XL_DOCUMENT = $10;
      XL_FORMAT = $1E;
      XL_COLWIDTH = $24;
      XL_FONT = $31;
    
      // XL Cell Types
      XL_INTEGER = $02;
      XL_DOUBLE = $03;
      XL_STRING = $04;
    
      // XL Cell Formats
      XL_INTFORMAT = $81;
      XL_DBLFORMAT = $82;
      XL_XDTFORMAT = $83;
      XL_DTEFORMAT = $84;
      XL_TMEFORMAT = $85;
      XL_HEADBOLD = $40;
      XL_HEADSHADE = $F8;
    
      // ========================
      // Create the class
      // ========================
    
    constructor TDataSetToExcel.Create;
    begin
      FFieldCount := 0;
    end;
    
    // ====================================
    // Write a Token Descripton Header
    // ====================================
    
    procedure TDataSetToExcel.WriteToken(AToken: word; ALength: word);
    var
      aTOKBuffer: array[0..1] of word;
    begin
      aTOKBuffer[0] := AToken;
      aTOKBuffer[1] := ALength;
      Blockwrite(FDataFile, aTOKBuffer, SizeOf(aTOKBuffer));
    end;
    
    // ====================================
    // Write the font information
    // ====================================
    
    procedure TDataSetToExcel.WriteFont(const AFontName: ansistring;
      AFontHeight, AAttribute: word);
    var
      iLen: byte;
    begin
      AFontHeight := AFontHeight * 20;
      WriteToken(XL_FONT, 5 + length(AFontName));
      BlockWrite(FDataFile, AFontHeight, 2);
      BlockWrite(FDataFile, AAttribute, 2);
      iLen := length(AFontName);
      BlockWrite(FDataFile, iLen, 1);
      BlockWrite(FDataFile, AFontName[1], iLen);
    end;
    
    // ====================================
    // Write the format information
    // ====================================
    
    procedure TDataSetToExcel.WriteFormat(const AFormatStr: ansistring);
    var
      iLen: byte;
    begin
      WriteToken(XL_FORMAT, 1 + length(AFormatStr));
      iLen := length(AFormatStr);
      BlockWrite(FDataFile, iLen, 1);
      BlockWrite(FDataFile, AFormatStr[1], iLen);
    end;
    
    // ====================================
    // Write the XL file from data set
    // ====================================
    
    function TDataSetToExcel.WriteFile(const AFilename:String; const AGrid: TUniDBGrid): boolean;
    var
      bRetvar: boolean;
      aDOCBuffer: array[0..1] of word;
      aDIMBuffer: array[0..3] of word;
      aAttributes: array[0..2] of byte;
      i: integer;
      iColNum,
      iDataLen: byte;
      sStrData: string;
      fDblData: double;
      wWidth: word;
      sStrBytes: TBytes;
    begin
      if not Assigned(AGrid) then
        raise Exception.Create('There is no Grid is vinculated.');
    
      if not Assigned(AGrid.DataSource) then
        raise Exception.Create('There is no DataSource is vinculated to Grid ' + AGrid.Name);
    
      if not Assigned(AGrid.DataSource.DataSet) then
        raise Exception.Create('There is no DataSet is vinculated to DataSource ' + AGrid.DataSource.Name);
    
      bRetvar := true;
      FRow := 0;
      FillChar(aAttributes, SizeOf(aAttributes), 0);
      FFileName := ChangeFileExt(AFilename, '.xls');
      AssignFile(FDataFile, FFileName);
    
      try
        Rewrite(FDataFile, 1);
        // Beginning of File
        WriteToken(XL_BOF, 4);
        aDOCBuffer[0] := 0;
        aDOCBuffer[1] := XL_DOCUMENT;
        Blockwrite(FDataFile, aDOCBuffer, SizeOf(aDOCBuffer));
    
        // Font Table
        WriteFont('Arial', 10, 0);
        WriteFont('Arial', 10, 1);
        //WriteFont('Courier New', 11, 0);
    
        // Column widths
        iColNum := 0;
        for i := 0 to AGrid.Columns.Count-1 do
        begin
          if not AGrid.Columns[i].Visible then
            continue;
    
          if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DisplayWidth + 1 >
             Length(AGrid.Columns[i].Title.Caption) then
          begin
            wWidth := (AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DisplayWidth + 1) * 256;
          end
          else
          begin
            wWidth := (Length(AGrid.Columns[i].Title.Caption) + 1) * 256;
          end;
    
          // Limitar o tamanho da coluna
          if wWidth > 80*256 then
            wWidth := 80*256;
    
    //      if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType = ftDateTime then
    //        inc(wWidth, 100);
    //      if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType = ftDate then
    //        inc(wWidth, 1050);
    //      if AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType = ftTime then
    //        inc(wWidth, 100);
    
          WriteToken(XL_COLWIDTH, 4);
    
          BlockWrite(FDataFile, iColNum, 1);
          BlockWrite(FDataFile, iColNum, 1);
          BlockWrite(FDataFile, wWidth, 2);
          Inc(iColNum);
        end;
    
        FFieldCount := iColNum;
    
        // Column Formats
        WriteFormat('Geral');
        WriteFormat('0');
        WriteFormat('#.##0,0000');
        WriteFormat('dd/mm/aaaa hh:mm:ss');
        WriteFormat('dd/mm/aaaa');
        WriteFormat('hh:mm:ss');
    
        // Dimensions
        WriteToken(XL_DIM, 8);
        aDIMBuffer[0] := 0;
        aDIMBuffer[1] := Min(AGrid.DataSource.DataSet.RecordCount, $FFFF);
        aDIMBuffer[2] := 0;
        aDIMBuffer[3] := Min(FFieldCount - 1, $FFFF);
        Blockwrite(FDataFile, aDIMBuffer, SizeOf(aDIMBuffer));
    
        // Column Headers
        iColNum := 0;
        for i := 0 to AGrid.Columns.Count-1 do
        begin
          if not AGrid.Columns[i].Visible then
            continue;
    
          //      sStrData := FDataSet.Fields[i].DisplayName;
          sStrBytes := TEncoding.ANSI.GetBytes(AGrid.Columns[i].Title.Caption);
          iDataLen := length(sStrBytes);
          WriteToken(XL_STRING, iDataLen + 8);
          WriteToken(FRow, iColNum);
          aAttributes[1] := XL_HEADBOLD;
          //aAttributes[2] := XL_HEADSHADE;
          BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes));
          BlockWrite(FDataFile, iDataLen, SizeOf(iDataLen));
          if iDataLen > 0 then
            BlockWrite(FDataFile, sStrBytes[0], iDataLen);
          aAttributes[2] := 0;
          Inc(iColNum);
        end;
    
        try
          AGrid.DataSource.DataSet.DisableControls;
          AGrid.DataSource.DataSet.First;
    
          // Data Rows
          while not AGrid.DataSource.DataSet.Eof do
          begin
            inc(FRow);
            iColNum := 0;
    
            for i := 0 to AGrid.Columns.Count-1 do
            begin
              if not AGrid.Columns[i].Visible then
                continue;
    
              case AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).DataType of
                  ftBoolean,
                  ftWideString,
                  ftFixedChar,
                  ftString:
                  begin
                    try
                      //              sStrData := FDataSet.Fields[i].AsString;
    
                      sStrBytes:=TEncoding.ANSI.GetBytes(AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsString);
                      iDataLen := length(sStrBytes);
                      WriteToken(XL_STRING, iDataLen + 8);
                      WriteToken(FRow, iColNum);
                      aAttributes[1] := 0;
                      BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes));
                      BlockWrite(FDataFile, iDataLen, SizeOf(iDataLen));
                      if iDataLen > 0 then
                        BlockWrite(FDataFile, sStrBytes[0], iDataLen);
                    except on E: Exception do
                      //ShowMessage(E.Message);
                      raise Exception.Create('Erro Converter: ' + E.Message);
                    end;
                  end;
    
                  ftAutoInc,
                  ftSmallInt,
                  ftInteger,
                  ftWord,
                  ftLargeInt:
                  begin
                    try
                    fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat;
                    iDataLen := SizeOf(fDblData);
                    WriteToken(XL_DOUBLE, 15);
                    WriteToken(FRow, iColNum);
                    aAttributes[1] := XL_INTFORMAT;
                    BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes));
                    BlockWrite(FDataFile, fDblData, iDatalen);
                    except on E: Exception do
                      //ShowMessage(E.Message);
                      raise Exception.Create('Erro Converter Inteiro: ' + E.Message);
                    end;
                  end;
    
                  ftFloat,
                  ftCurrency,
                  ftBcd,
                  ftFMTBcd:
                  begin
                    try
                    fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat;
                    iDataLen := SizeOf(fDblData);
                    WriteToken(XL_DOUBLE, 15);
                    WriteToken(FRow, iColNum);
                    aAttributes[1] := XL_DBLFORMAT;
                    BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes));
                    BlockWrite(FDataFile, fDblData, iDatalen);
                    except on E: Exception do
                      //ShowMessage(E.Message);
                      raise Exception.Create('Erro Converter Float: ' + E.Message);
                    end;
                  end;
    
                ftDateTime:
                  begin
                    try
                      if not AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).IsNull then
                      begin
                        fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat;
                        iDataLen := SizeOf(fDblData);
                        WriteToken(XL_DOUBLE, 15);
                        WriteToken(FRow, iColNum);
                        aAttributes[1] := XL_XDTFORMAT;
                        BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes));
                        BlockWrite(FDataFile, fDblData, iDatalen);
                      end;
                    except on E: Exception do
                      //ShowMessage(E.Message);
                      raise Exception.Create('Erro Converter DateTime: ' + E.Message);
                    end;
                  end;
    
                ftDate:
                  begin
                    try
                      if not AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).IsNull then
                      begin
                        fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat;
                        iDataLen := SizeOf(fDblData);
                        WriteToken(XL_DOUBLE, 15);
                        WriteToken(FRow, iColNum);
                        aAttributes[1] := XL_DTEFORMAT;
                        BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes));
                        BlockWrite(FDataFile, fDblData, iDatalen);
                      end;
                    except on E: Exception do
                      //ShowMessage(E.Message);
                      raise Exception.Create('Erro Converter Date: ' + E.Message);
                    end;
                  end;
    
                ftTime:
                  begin
                    try
                      if not AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).IsNull then
                      begin
                        fDblData := AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).AsFloat;
                        iDataLen := SizeOf(fDblData);
                        WriteToken(XL_DOUBLE, 15);
                        WriteToken(FRow, iColNum);
                        aAttributes[1] := XL_TMEFORMAT;
                        BlockWrite(FDataFile, aAttributes, SizeOf(aAttributes));
                        BlockWrite(FDataFile, fDblData, iDatalen);
                      end;
                    except on E: Exception do
                      //ShowMessage(E.Message);
                      raise Exception.Create('Erro Converter Time: ' + E.Message);
                    end;
                  end;
    
                ftMemo:
                  begin
                    // Does not print memo
                  end;
    
              else raise Exception.Create('Tipo [' + AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).ClassName + '] do campo [' +
                                          AGrid.DataSource.DataSet.FieldByName(AGrid.Columns[i].FieldName).FieldName + '] não foi tratado.');
    
              end;
    
              Inc(iColNum);
            end; // end of for
    
            AGrid.DataSource.DataSet.Next;
          end; // end of while
    
        finally
          AGrid.DataSource.DataSet.EnableControls;
          AGrid.DataSource.DataSet.First;
        end;
    
        // End of File
        WriteToken(XL_EOF, 0);
        CloseFile(FDataFile);
      except
        bRetvar := false;
      end;
    
      Result := bRetvar;
    end;
    
    end.

     

  7. SMARAM

    Erase Cached CSS

    This is what i'm looking to do. https://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files?rq=1 I'm waiting for my IT to send me the user and psw to open the ticket.
  8. SMARAM

    Erase Cached CSS

    Ok, thank you. I'm going to do that.
  9. SMARAM

    Erase Cached CSS

    Suggestions?
  10. SMARAM

    Erase Cached CSS

    1) I'm changing the file "ext\build\classic\theme-neptune\resources\theme-neptune-all_1.css" with notepad. 2) deploy the file to server 3) restart IIS 4) open website on user's computer. 5) CSS is not loaded because it's cached. 6) Need to press Ctrl + F5 to reload CSS (I would like to not press Ctrl + F5 to reload CSS).
  11. SMARAM

    Erase Cached CSS

    I'm changing theme like theme-neptune-all_1.css I would like the appplication could automatically reload css but it's using the cached css.
  12. SMARAM

    Column Locked - UniDBGrid

    Hi, I need to lock a column on the right side. In this case, the last column in the unidbgrid. Is it possible ? Thanks!
  13. SMARAM

    Access Violation on TADOQuery Create

    Hi Farshad. Thanks for your reply. How do you suggest to create dinamically query? Maybe this way? TADOQuery *query = new TADOQuery(UniMainModule());
  14. Hi, I'm having problem with access violation that starts with on a session then all others sessions give acces violation too. I configure logMadExcept on my project because I could not configure EurekaLog on C++ Builder. Could someone help me with any advice. This is the error and log: Access violation at address 02778904 in module 'SMARamWeb.dll'. Read of address 000104F4 PS: To make things worst, it does not happen all the time. 02778904 SMARamWeb.dll System.Classes 12744 TComponent.Notification 02875d3e SMARamWeb.dll Uniguiserver TUniGUIServerModule.HandleException 028bca81 SMARamWeb.dll Uniguiapplication TUniGUISession.HandleException 02894546 SMARamWeb.dll Uniguiform TUniBaseForm.DoCreate 770b068a ntdll.dll KiUserExceptionDispatcher 0277878d SMARamWeb.dll System.Classes 12668 TComponent.RemoveComponent 02778551 SMARamWeb.dll System.Classes 12559 TComponent.Destroy 02a33c7b SMARamWeb.dll Data.DB 11076 TDataSet.Destroy 02aaee91 SMARamWeb.dll Data.Win.ADODB 3517 TCustomADODataSet.Destroy 02ab7add SMARamWeb.dll Data.Win.ADODB 6353 TADOQuery.Destroy 770b068a ntdll.dll KiUserExceptionDispatcher 02778768 SMARamWeb.dll System.Classes 12662 TComponent.InsertComponent 02778503 SMARamWeb.dll System.Classes 12551 TComponent.Create 02a33aab SMARamWeb.dll Data.DB 11043 TDataSet.Create 02aaed13 SMARamWeb.dll Data.Win.ADODB 3488 TCustomADODataSet.Create 02ab7a63 SMARamWeb.dll Data.Win.ADODB 6345 TADOQuery.Create 015ed027 SMARamWeb.dll FuncoesUN.cpp 3582 RegistrarLogAccesso 01e7a0cf SMARamWeb.dll ME130500.cpp 1084 TFormItemRME.UniFormCreate 028944f5 SMARamWeb.dll Uniguiform TUniBaseForm.DoCreate 02894135 SMARamWeb.dll Uniguiform TUniBaseForm.Create 02897002 SMARamWeb.dll Uniguiform TUniForm.Create 01e6a863 SMARamWeb.dll ME130500.cpp 38 TFormItemRME.Create 01f43273 SMARamWeb.dll MEP30500.cpp 799 TFormRME.DBGridMaterialDblClick 01f43c30 SMARamWeb.dll MEP30500.cpp 851 TFormRME.BtnIncluiRMEClick 028a18b7 SMARamWeb.dll Uniguiclasses TUniControl.DoClick 02850694 SMARamWeb.dll Unibutton TUniCustomButton.DoClick 0284ff10 SMARamWeb.dll Unibutton TUniCustomButton.ClickHandler 02886f9b SMARamWeb.dll Uniguijsinterface TUniJSHelper.HandleEvent 028a2f59 SMARamWeb.dll Uniguiclasses TUniControl.HandleEventIntercept 0287159d SMARamWeb.dll Uniguisessionmanager TUniSessionWorkerThread.ProcessEvent 028b536b SMARamWeb.dll Uniguiapplication TUniGUISession.ProcessEventQueue 028b54ac SMARamWeb.dll Uniguiapplication TUniGUISession.ProcessEvents 0288a21f SMARamWeb.dll Uniguijsform TUniBaseJSForm.ShowModal 028955fb SMARamWeb.dll Uniguiform TUniBaseForm.ShowModal 01ead093 SMARamWeb.dll MenuInicial.cpp 3175 TMenuInicialForm.htmlMenuAjaxEvent 763e5448 OLEAUT32.dll SysAllocStringLen 770b80e1 ntdll.dll bsearch 763e6756 OLEAUT32.dll VariantChangeType 763e5448 OLEAUT32.dll SysAllocStringLen 0268a456 SMARamWeb.dll Vcl.Controls 11737 TWinControl.SetBounds 027d733a SMARamWeb.dll System 14206 @ClassDestroy 02ab7afb SMARamWeb.dll Data.Win.ADODB 6355 TADOQuery.Destroy 015ee0e2 SMARamWeb.dll FuncoesUN.cpp 3642 RegistrarLogAccesso 026918c3 SMARamWeb.dll Vcl.Controls 16303 TMargins.SetControlBounds 02685501 SMARamWeb.dll Vcl.Controls 8495 TWinControl.ArrangeControl 026857fe SMARamWeb.dll Vcl.Controls 8541 DoPosition 027d733a SMARamWeb.dll System 14206 @ClassDestroy 027d6cb0 SMARamWeb.dll System 13025 TObject.Free 026918dc SMARamWeb.dll Vcl.Controls 16305 TMargins.SetControlBounds 02685501 SMARamWeb.dll Vcl.Controls 8495 TWinControl.ArrangeControl 02685522 SMARamWeb.dll Vcl.Controls 8497 TWinControl.ArrangeControl 026857fe SMARamWeb.dll Vcl.Controls 8541 DoPosition 0276b07d SMARamWeb.dll System.Classes 5588 TStrings.IndexOf 0276c585 SMARamWeb.dll System.Classes 6272 TStringList.IndexOf 02886df6 SMARamWeb.dll Uniguijsinterface TUniJSHelper.FindHandlers 028a2d6d SMARamWeb.dll Uniguiclasses TUniControl.DOHandleEvent 028a2f78 SMARamWeb.dll Uniguiclasses TUniControl.HandleEventIntercept 0287159d SMARamWeb.dll Uniguisessionmanager TUniSessionWorkerThread.ProcessEvent 0287178b SMARamWeb.dll Uniguisessionmanager TUniSessionWorkerThread.Execute 027774a6 SMARamWeb.dll System.Classes 11769 ThreadProc 027d8838 SMARamWeb.dll System 18806 ThreadWrapper 76007c02 KERNEL32.DLL BaseThreadInitThunk The line where it gives the error.
  15. SMARAM

    Move TUniPanel into TUniHtmlFrame

    I have a side menu collapsible and with menus like accordion that I made with uniHtmlFrame. But I would like to use unigui components in it like uniComboBox and uniDateTimePicker. I tried with jquery replaceWith and it does work. But when I change screen size for example, the unipanel move back to it's original position.
  16. Hi, is there a way to move an uniPanel into an uniHtmlFrame? Why I'm doing that? I have an uniHtmlFrame that I made a side menu collapsible that has "ul", "li" and "a" tags. I would like to move a panel into the uniHtmlFrame that has unigui components like uniDateTimePicker, uniComboBox, etc. Is there any way to do it?
  17. SMARAM

    Move TUniPanel into TUniHtmlFrame

    How can I use the unigui component on a uniHtmlFrame? Only copying manually the html content?
  18. Hi, I'm having trouble with my isapi application that is going down when total/active threads reaches it's max like the attached image. What does make it go high and freeze application? Is there any documentation how to configure the ThreadPoolSize? All the components that I'm using in the project; - ADOComponents - SQL Server 2005/2008 (depends the customer) - Report Tools QuickReport 5.05.1 and Rave Reports 10.0 - TClientDataSet
  19. Ok, the error about the default printer is gone but now it doesn't throw an exception on client but on server, it pops this error: "An unhandled win32 exception occurred in w3wp.exe [4408]. The Just-In-Time debugger was launched without necessary security permissions. To debug this process, the Just-In-Time debugger must be run as an Administrator. Would you like to debug this process?"
  20. If a change to LocalSystem, it returns the error when I try to print my report: "there is no default printer currently selected"
  21. The Async mode is for printing QuickReport. Is there a way to identify threads that never returns? I made a test trying to print a report with too many rows and it never returns. Yes. I made a test and confirmed that when you have one quickreport generating, the thread grows and never get down.
  22. Hi, Did anyone make eurekalog integrate with C++ Builder? I'm having problem with it. I already made it with Delphi but I'm having trouble C++ Builder maybe because of the EAppUnigui.pas that it's not in C++ language.
  23. SMARAM

    EurekaLog not working on C++ Builder

    I was trying to convert creating a package in delphi and adding the file into it but without success Thank you! Let me know when it's done please. And could you send an example project in C++ Builder too (Standalone and Isapi)?
  24. SMARAM

    Problem exporting data to MSWord

    I'm running the service as administrator too.
  25. SMARAM

    Problem exporting data to MSWord

    Hi there, Could anyone help me with exporting data to MSWord? I have a procedure that works on desktop but doesn't work when on ISAPI. It works on unigui exe too. CoInitialize(NULL); try { Variant vMSWord; Variant vWDocuments, vWDocument; vMSWord = Variant::CreateObject("Word.Application"); String vNomeArq = ""; try { vMSWord.OlePropertySet("Visible", true); vNomeArq = UniServerInstance()->StartPath + "modelo.doc"; vWDocuments = vMSWord.OlePropertyGet("Documents"); OleVariant vFileName = vNomeArq; Variant vLink = Unassigned; Variant vReadOnly = false; Variant vFormat = Unassigned; vWDocument = vWDocuments.OleFunction("Open", vFileName, vLink, vReadOnly, vFormat); OleVariant vTxtOld = "<NOME>"; OleVariant vTxtNew = "FULANO DA SILVA"; vMSWord.OlePropertyGet("Selection").OleFunction("HomeKey", 6); vMSWord.OlePropertyGet("Selection").OlePropertyGet("Find").OleFunction("Execute", vTxtOld, false, true, false, false, false, true, false, false, vTxtNew, 2, false, false, false, false); vWDocument.OleProcedure("Save"); vWDocuments.OleFunction("Close"); vMSWord.OleFunction("Quit"); } catch (Exception &erro) { ShowMessage("Erro: " + vNomeArq + " - " + erro.Message); } } __finally { CoUninitialize; }
×