Quantcast
Channel: Adobe Community : Popular Discussions - InDesign SDK
Viewing all articles
Browse latest Browse all 78596

InDesign CS6 and C# (Regular expression)

$
0
0

GREP does not work

 

//*******************************************

//CODE

//*******************************************

InDesign.Application InDesignApp = (InDesign.Application)Activator.CreateInstance(Type.GetTypeFromProgID("InDesign.Applicati on"));

 

InDesignApp.Activate();

 

//Create Document

InDesign.Document InDesignDoc = InDesignApp.Documents.Add();

 

//PageWidth

InDesignDoc.DocumentPreferences.PageWidth = Convert.ToDouble(numericUpDown_width.Value);

 

//PageHeight

InDesignDoc.DocumentPreferences.PageHeight = Convert.ToDouble(numericUpDown_height.Value);

 

InDesignDoc.DocumentPreferences.PageOrientation = idPageOrientation.idPortrait;

 

InDesignDoc.DocumentPreferences.PagesPerDocument = 50;

 

InDesignDoc.DocumentPreferences.StartPageNumber = 1;

 

InDesign.Page page = (InDesign.Page)InDesignDoc.Pages[1];

InDesign.Layer layer = (InDesign.Layer)InDesignDoc.Layers[1];

 

//Place *.docx in Document

page.Place("C:\\sample.docx", new[] { 0, 0 }, layer, false, true);

 

InDesign.Document Doc = (InDesign.Document)InDesignApp.ActiveDocument;

 

//Clear the find/change grep preferences

InDesignApp.FindGrepPreferences = idNothingEnum.idNothing;

InDesignApp.ChangeGrepPreferences = idNothingEnum.idNothing;

 

//Set the find options

InDesignApp.FindChangeGrepOptions.includeFootnotes = true;

InDesignApp.FindChangeGrepOptions.includeHiddenLayers = true;

InDesignApp.FindChangeGrepOptions.includeLockedLayersForFind = true; ;

InDesignApp.FindChangeGrepOptions.includeLockedStoriesForFind = true;

InDesignApp.FindChangeGrepOptions.includeMasterPages = true;

 

//Regular expression for finding an email address

InDesignApp.FindGrepPreferences.findWhat = "(?i)[A-Z]*?@[A-Z]*?[.]...";

 

Doc.FindGrep();

 

//Apply the change to 24-point text only

InDesignApp.FindGrepPreferences.pointSize = 28;

InDesignApp.ChangeGrepPreferences.underline = true;

Doc.ChangeGrep();

 

//Clear the find/change grep preferences

InDesignApp.FindGrepPreferences = idNothingEnum.idNothing;

InDesignApp.ChangeGrepPreferences = idNothingEnum.idNothing;

 

//******************************************* 

//END CODE

//******************************************* 

where am I wrong?


Viewing all articles
Browse latest Browse all 78596


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>