variant和rawbytestring相互转换
uses Variants; function VariantArrayToString(const V: OleVariant): RawByteString; var P: Pointer; Size: Integer; begin Result := ''; if VarIsArray(V) and (VarType(V) and varTypeMask = varByte) then begin Size := VarArrayHighBound(V, 1) - VarArrayLowBound(V, 1) + 1; if Size > 0 then begin SetLength(Result, Size); P := VarArrayLock(V); try Move(P^, Result[1], Size); finally VarArrayUnlock(V); end; end; end; end; function StringToVariantArray(const S: RawByteString): OleVariant; var P: Pointer; begin Result := NULL; if Length(S) > 0 then begin Result := VarArrayCreate([0, Length(S) - 1], varByte); P := VarArrayLock(Result); try Move(S[1], P^, Length(S)); finally VarArrayUnlock(Result); end; end; end;
Context.OutContent := SynCommons.BinToBase64(VariantArrayToString(DataSetProvider1.Data));
Delta := StringToVariantArray(SynCommons.Base64ToBin(AEnv.Context.InContent));