'Integrate & use regex script in Shortcuts for iPadOS
I’m newbie in coding. Since many days, i search to make a script on my iPad (my only computer) with Shortcuts & Scriptable for find and replace text from a word document.
I understand that use Javascript on iPadOS is necessary to go out the limit of Shortcuts from Apple.
I’ve have a schortcuts which find the good file, but i can’t exploit script from Scriptable.
using System.IO;
using System.Text.RegularExpressions;
using DocumentFormat.OpenXml.Packaging;
using (WordprocessingDocument wordDoc =
WordprocessingDocument.Open(document, true))
{
public static void SearchAndReplace(string document)
{
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(document, true))
{
string docText = null;
using (StreamReader sr = new StreamReader(wordDoc.MainDocumentPart.GetStream()))
{
docText = sr.ReadToEnd();
}
Regex regexText = new Regex("XXX");
docText = regexText.Replace(docText, "Chat");
using (StreamWriter sw = new StreamWriter(wordDoc.MainDocumentPart.GetStream(FileMode.Create)))
{
sw.Write(docText);
}
}
}
}
Are-you any idea ?
To be complete, i want make this. enter image description here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|