Add text file to drawing using jlink
I am trying to add a text file of notes to a drawing using JLink. I have tried using code shown by PTC Located here: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS206301&lang=en&source=snippet
but when I change the string to a line read it fails. Here is the code I am using:
DetailNoteItem note = null;
DetailTextLines allLines = DetailTextLines.create();
int number=0;
while(lineRead!=null) // example shows for 3 lines. However, this could be the actual number of lines present in your input text file on disk
{
String iLineText = "Test " + number; This works but if I change number to lineRead it fails.
DetailTexts iDetailTexts = DetailTexts.create();
iDetailTexts.insert(0, pfcDetail.DetailText_Create(iLineText));
allLines.insert(number, pfcDetail.DetailTextLine_Create(iDetailTexts));
lineRead = textList.readLine();
number++;
}
textList.close();
// Allocate a note description, and set its properties
DetailNoteInstructions instrs = pfcDetail.DetailNoteInstructions_Create(allLines);
instrs.SetLeader(allAttachments);
// Create the note
note = (DetailNoteItem) drawing.CreateDetailItem(instrs);
note.Show();
