@@ -91,26 +91,293 @@ Using an SDK (API client) is the quickest way for a developer to speed up the de
9191
9292{{< tabs "example2">}} {{< tab "C#" >}}
9393
94- {{< gist groupdocscloud 34f0df87ff6e7aaffef5876bdcb04a38 Editor_CSharp_Working_With_DSV.cs >}}
94+ ``` csharp
95+ // For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-dotnet-samples
96+ string MyAppKey = " " ; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
97+ string MyAppSid = " " ; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
98+
99+ var configuration = new Configuration (MyAppSid , MyAppKey );
100+
101+ // Create necessary API instances
102+ var editApi = new EditApi (configuration );
103+ var fileApi = new FileApi (configuration );
104+
105+ // The document already uploaded into the storage.
106+ // Load it into editable state
107+ var loadOptions = new DelimitedTextLoadOptions
108+ {
109+ FileInfo = new FileInfo
110+ {
111+ FilePath = " Spreadsheet/sample.tsv"
112+ },
113+ OutputPath = " output"
114+ };
115+ var loadResult = editApi .Load (new LoadRequest (loadOptions ));
116+
117+ // Download html document
118+ var stream = fileApi .DownloadFile (new DownloadFileRequest (loadResult .HtmlPath ));
119+ var htmlString = new StreamReader (stream , Encoding .UTF8 ).ReadToEnd ();
120+
121+ // Edit something...
122+ htmlString = htmlString .Replace (" 32" , " 66" );
123+
124+ // Upload html back to storage
125+ fileApi .UploadFile (new UploadFileRequest (loadResult .HtmlPath ,
126+ new MemoryStream (Encoding .UTF8 .GetBytes (htmlString ))));
127+
128+ // Save html back to tsv
129+ var saveOptions = new DelimitedTextSaveOptions
130+ {
131+ FileInfo = loadOptions .FileInfo ,
132+ OutputPath = " output/edited.tsv" ,
133+ HtmlPath = loadResult .HtmlPath ,
134+ ResourcesPath = loadResult .ResourcesPath
135+ };
136+ var saveResult = editApi .Save (new SaveRequest (saveOptions ));
137+ ```
95138
96139{{< /tab >}} {{< tab "Java" >}}
97140
98- {{< gist groupdocscloud cb5b0d1ae842f50f90382640823a2004 Editor_Java_Working_With_DSV.java >}}
141+ ``` java
142+ // For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-java-samples
143+ String MyAppKey = " " ; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
144+ String MyAppSid = " " ; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
145+
146+ Configuration configuration = new Configuration (MyAppSid , MyAppKey );
147+
148+
149+ // Create necessary API instances
150+ EditApi editApi = new EditApi (configuration);
151+ FileApi fileApi = new FileApi (configuration);
152+
153+ // The document already uploaded into the storage.
154+ // Load it into editable state
155+ FileInfo fileInfo = new FileInfo ();
156+ fileInfo. setFilePath(" Spreadsheet/sample.tsv" );
157+ DelimitedTextLoadOptions loadOptions = new DelimitedTextLoadOptions ();
158+ loadOptions. setFileInfo(fileInfo);
159+ loadOptions. setOutputPath(" output" );
160+ LoadResult loadResult = editApi. load(new LoadRequest (loadOptions));
161+
162+ // Download html document
163+ File file = fileApi. downloadFile(new DownloadFileRequest (loadResult. getHtmlPath(), null , null ));
164+
165+ // Edit something...
166+ List<String > lines = Files . readAllLines(file. toPath());
167+ List<String > newLines = new ArrayList<String > ();
168+ for (String line : lines) {
169+ newLines. add(line. replaceAll(" 32" , " 66" ));
170+ }
171+ Files . write(file. toPath(), newLines);
172+
173+ // Upload html back to storage
174+ fileApi. uploadFile(new UploadFileRequest (loadResult. getHtmlPath(), file, Common . MYStorage ));
175+
176+ // Save html back to tsv
177+ DelimitedTextSaveOptions saveOptions = new DelimitedTextSaveOptions ();
178+ saveOptions. setFileInfo(fileInfo);
179+ saveOptions. setOutputPath(" output/edited.tsv" );
180+ saveOptions. setHtmlPath(loadResult. getHtmlPath());
181+ saveOptions. setResourcesPath(loadResult. getResourcesPath());
182+ DocumentResult saveResult = editApi. save(new SaveRequest (saveOptions));
183+
184+ System . out. println(" Document edited: " + saveResult. getPath());
185+ ```
99186
100187{{< /tab >}} {{< tab "PHP" >}}
101188
102- {{< gist groupdocscloud 288fe44b5603cd7966fa72f293e91b88 Editor_Php_Working_With_DSV.php >}}
189+ ``` php
190+ // For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-php-samples
191+ use GroupDocs\Editor\Model;
192+ use GroupDocs\Editor\Model\Requests;
193+
194+
195+ $AppSid = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
196+ $AppKey = ""; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
197+
198+ $configuration = new GroupDocs\Editor\Configuration();
199+ $configuration->setAppSid($AppSid);
200+ $configuration->setAppKey($AppKey);
201+
202+ $editApi = new GroupDocs\Editor\EditApi($configuration);
203+ $fileApi = new GroupDocs\Editor\FileApi($configuration);
204+
205+ // The document already uploaded into the storage
206+ // Load it into editable state
207+ $fileInfo = new Model\FileInfo();
208+ $fileInfo->setFilePath("Spreadsheet/sample.tsv");
209+ $loadOptions = new Model\DelimitedTextLoadOptions();
210+ $loadOptions->setFileInfo($fileInfo);
211+ $loadOptions->setOutputPath("output");
212+ $loadResult = $editApi->load(new Requests\loadRequest($loadOptions));
213+
214+ // Download html document
215+ $htmlFile = $fileApi->downloadFile(new Requests\downloadFileRequest($loadResult->getHtmlPath()));
216+ $html = file_get_contents($htmlFile->getRealPath());
217+
218+ // Edit something...
219+ $html = str_replace("32", "66", $html);
220+
221+ // Upload html back to storage
222+ file_put_contents($htmlFile->getRealPath(), $html);
223+ $uploadRequest = new Requests\uploadFileRequest($loadResult->getHtmlPath(), $htmlFile->getRealPath());
224+ $fileApi->uploadFile($uploadRequest);
225+
226+ // Save html back to tsv
227+ $saveOptions = new Model\DelimitedTextSaveOptions();
228+ $saveOptions->setFileInfo($fileInfo);
229+ $saveOptions->setOutputPath("output/edited.tsv");
230+ $saveOptions->setHtmlPath($loadResult->getHtmlPath());
231+ $saveOptions->setResourcesPath($loadResult->getResourcesPath());
232+ $saveResult = $editApi->save(new Requests\saveRequest($saveOptions));
233+
234+ // Done.
235+ echo "Document edited: " . $saveResult->getPath();
236+ ```
103237
104238{{< /tab >}} {{< tab "Ruby" >}}
105239
106- {{< gist groupdocscloud ba011159eee59cd5a1f696ae6fadb2e4 Editor_Ruby_Working_With_DSV.rb >}}
240+ ``` ruby
241+ # For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-ruby-samples
242+ require ' groupdocs_editor_cloud'
243+
244+ $app_sid = " XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud
245+ $app_key = " XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud
246+
247+ # Create necessary API instances
248+ fileApi = GroupDocsEditorCloud ::FileApi .from_keys($app_sid , $app_key )
249+ editApi = GroupDocsEditorCloud ::EditApi .from_keys($app_sid , $app_key )
250+
251+ # The document already uploaded into the storage.
252+ # Load it into editable state
253+ fileInfo = GroupDocsEditorCloud ::FileInfo .new
254+ fileInfo.file_path = ' Spreadsheet/sample.tsv'
255+
256+ loadOptions = GroupDocsEditorCloud ::DelimitedTextLoadOptions .new
257+ loadOptions.file_info = fileInfo
258+ loadOptions.output_path = " output"
259+
260+ loadRequest = GroupDocsEditorCloud ::LoadRequest .new (loadOptions)
261+ loadResult = editApi.load (loadRequest)
262+
263+ # Download html document
264+ htmlFile = fileApi.download_file(GroupDocsEditorCloud ::DownloadFileRequest .new loadResult.html_path)
265+ htmlFile.open
266+ html = htmlFile.read
267+ htmlFile.close
268+
269+ # Edit something...
270+ html = html.gsub (" 32" , " 66" )
271+
272+ # Upload html back to storage
273+ htmlFile = File .open (htmlFile.path, " w" )
274+ htmlFile.write(html)
275+ htmlFile.close
276+ uploadRequest = GroupDocsEditorCloud ::UploadFileRequest .new loadResult.html_path, File .open (htmlFile.path, " r" )
277+ fileApi.upload_file(uploadRequest)
278+
279+ # Save html back to tsv
280+ saveOptions = GroupDocsEditorCloud ::DelimitedTextSaveOptions .new
281+ saveOptions.file_info = fileInfo
282+ saveOptions.output_path = " output/edited.tsv"
283+ saveOptions.html_path = loadResult.html_path
284+ saveOptions.resources_path = loadResult.resources_path
285+
286+ saveRequest = GroupDocsEditorCloud ::SaveRequest .new (saveOptions)
287+ saveResult = editApi.save(saveRequest)
288+
289+ puts (" Document edited: " + saveResult.path)
290+ ```
107291
108292{{< /tab >}} {{< tab "Node.js" >}}
109293
110- {{< gist groupdocscloud d42190d60101442ccba939ac4db41454 Editor_Node_Working_With_DSV.js >}}
294+ ``` js
295+ // For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-node-samples
296+ global .editor_cloud = require (" groupdocs-editor-cloud" );
297+
298+ global .appSid = " XXXX-XXXX-XXXX-XXXX" ; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
299+ global .appKey = " XXXXXXXXXXXXXXXX" ; // Get AppKey and AppSID from https://dashboard.groupdocs.cloud
300+
301+ global .editApi = editor_cloud .EditApi .fromKeys (appSid, appKey);
302+ global .fileApi = editor_cloud .FileApi .fromKeys (appSid, appKey);
303+
304+
305+ // The document already uploaded into the storage.
306+ // Load it into editable state
307+ let fileInfo = new editor_cloud.FileInfo ();
308+ fileInfo .filePath = " Spreadsheet/sample.tsv" ;
309+ let loadOptions = new editor_cloud.DelimitedTextLoadOptions ();
310+ loadOptions .fileInfo = fileInfo;
311+ loadOptions .outputPath = " output" ;
312+ let loadResult = await editApi .load (new editor_cloud.LoadRequest (loadOptions));
313+
314+ // Download html document
315+ let buf = await fileApi .downloadFile (new editor_cloud.DownloadFileRequest (loadResult .htmlPath ));
316+ let htmlString = buf .toString (" utf-8" );
317+
318+ // Edit something...
319+ htmlString = htmlString .replace (" 32" , " 66" );
320+
321+ // Upload html back to storage
322+ await fileApi .uploadFile (new editor_cloud.UploadFileRequest (loadResult .htmlPath , new Buffer (htmlString, " utf-8" )));
323+
324+ // Save html back to docx
325+ let saveOptions = new editor_cloud.DelimitedTextSaveOptions ();
326+ saveOptions .fileInfo = fileInfo;
327+ saveOptions .outputPath = " output/edited.tsv" ;
328+ saveOptions .htmlPath = loadResult .htmlPath ;
329+ saveOptions .resourcesPath = loadResult .resourcesPath ;
330+ let saveResult = await editApi .save (new editor_cloud.SaveRequest (saveOptions));
331+
332+ // Done.
333+ console .log (" Document edited: " + saveResult .path );
334+ ```
111335
112336{{< /tab >}} {{< tab "Python" >}}
113337
114- {{< gist groupdocscloud 49c298f42348259cd85175f315d57272 Editor_Python_Working_With_DSV.py >}}
338+ ``` python
339+ # For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-python-samples
340+ import groupdocs_editor_cloud
341+
342+ app_sid = " XXXX-XXXX-XXXX-XXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud
343+ app_key = " XXXXXXXXXXXXXXXX" # Get AppKey and AppSID from https://dashboard.groupdocs.cloud
344+
345+ editApi = groupdocs_editor_cloud.EditApi.from_keys(app_sid, app_key)
346+ fileApi = groupdocs_editor_cloud.FileApi.from_keys(app_sid, app_key)
347+
348+ # The document already uploaded into the storage.
349+ # Load it into editable state
350+ fileInfo = groupdocs_editor_cloud.FileInfo(" Spreadsheet/sample.tsv" )
351+ loadOptions = groupdocs_editor_cloud.DelimitedTextLoadOptions()
352+ loadOptions.file_info = fileInfo
353+ loadOptions.output_path = " output"
354+ loadResult = editApi.load(groupdocs_editor_cloud.LoadRequest(loadOptions))
355+
356+ # Download html document
357+ htmlFile = fileApi.download_file(groupdocs_editor_cloud.DownloadFileRequest(loadResult.html_path))
358+ html = " "
359+ with open (htmlFile, ' r' ) as file :
360+ html = file .read()
361+
362+ # Edit something...
363+ html = html.replace(" 32" , " 66" )
364+
365+ # Upload html back to storage
366+ with open (htmlFile, ' w' ) as file :
367+ file .write(html)
368+
369+ fileApi.upload_file(groupdocs_editor_cloud.UploadFileRequest(loadResult.html_path, htmlFile))
370+
371+ # Save html back to tsv
372+ saveOptions = groupdocs_editor_cloud.DelimitedTextSaveOptions()
373+ saveOptions.file_info = fileInfo
374+ saveOptions.output_path = " output/edited.tsv"
375+ saveOptions.html_path = loadResult.html_path
376+ saveOptions.resources_path = loadResult.resources_path
377+ saveResult = editApi.save(groupdocs_editor_cloud.SaveRequest(saveOptions))
378+
379+ # Done
380+ print (" Document edited: " + saveResult.path)
381+ ```
115382
116383{{< /tab >}} {{< /tabs >}}
0 commit comments