From Clomosy Docs

The TclShareService class allows you to share files, images, or text content directly using the native sharing features of the device. It provides a simple way to integrate content sharing functions (such as sharing a document, CSV file, or text) in Clomosy applications with full Android and iOS support.

TclShareService : A component that enables sharing of files, images, or text through the system's default share dialog.

Feature Use of Definition
TclShareService ShareService : TclShareService; A variable belonging to the TclShareService class is created.
Create ShareService = TclShareService.Create; Creates a new instance of the share service.
Destroy ShareService.Destroy; Releases the share service object from memory.
AddFile ShareService.AddFile(Clomosy.AppFilesPath + DocName); Adds a file to the sharing queue.
AddImage ShareService.AddImage(Image1.Bitmap); Adds an image to be shared.
AddText ShareService.AddText('This is a shared message'); Adds plain text content to be shared.
Share ShareService.Share; Opens the native device share dialog to perform the sharing action.


The TclShareService is typically used after generating or downloading a file (such as a PDF or CSV), or when you want to share text or images with other applications. You can add multiple items (files, images, or text) before calling the Share method. Once Share() is executed, the system’s default share interface appears, allowing the user to select how to share the content.



Example

var   
  Form1 : TclForm;
  BtnShare : TclProButton;
  ShareService : TclShareService;

void OnShareBtnClick;
  var filePath, CSVText: string;
{
  filePath = Clomosy.AppFilesPath + 'demo_export.csv';

  // Example CSV content
  CSVText = 'Name;Age;City' + #13#10 + 
            'Alice;24;London' + #13#10 + 
            'Bob;29;Paris';

  // Save file to app directory
  clSaveToFile(filePath, CSVText);

  // Initialize share service and share the file
  ShareService = TclShareService.Create;
  ShareService.AddFile(filePath);
  ShareService.Share;
}

void SetFormComponents;
{
  BtnShare = Form1.AddNewProButton(Form1, 'BtnShare', 'Share File');
  BtnShare.Align = alCenter;
  BtnShare.Width = 160;
  BtnShare.Height = 50;
  BtnShare.clProSettings.FontSize = 14;
  BtnShare.clProSettings.IsRound = True;
  BtnShare.clProSettings.RoundHeight = 15;
  BtnShare.clProSettings.RoundWidth = 15;
  BtnShare.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#565bad');
  BtnShare.clProSettings.FontColor = clAlphaColor.clHexToColor('#FFFFFF');
  BtnShare.SetclProSettings(BtnShare.clProSettings);
  BtnShare.OnClick = 'OnShareBtnClick';
}

{
  Form1 = TclForm.Create(Self);
  SetFormComponents;
  Form1.Run;
}