Reply
 
LinkBack Thread Tools Display Modes
Old 06-24-2009, 12:19 PM   #1 (permalink)
CrystalHacker
Guest
 
Posts: n/a
Default SetRTFControl Throws Exception when RTF File is ReadOnly

I have several reports where I integrate signatures and cover letters that are attached to the Project folder. The ReportUtilities.SetImage method works great in all cases however the following will throw an exception if the referenced RTF file is Read-Only.

ReportUtilities.SetRTFControl(rpt,"GroupHeader1"," txtCoverLetter",coverLetterPath)

Everything works fine as long as the Project is checked out. But when the Project is Checked-In all files on the local machine are set to Read-Only. So I can't run these reporrts without first checking out the Project.

Does anyone know know how to how to test the file attribute for Read-Only and set ReadOnly to false during the report invocation?

-ch
  Reply With Quote
Old 06-24-2009, 02:03 PM   #2 (permalink)
Senior Member
 
Join Date: May 2009
Location: Chennai, India
Posts: 157
nkarthick is on a distinguished road
Default

I have updated the script code. Please include the below code before assigning the RTF document in to the RichTextBox control.

Note: new code is encapsulated with in '*****' symbols.

Code:
  filePath = System.IO.Path.Combine(projectFolderNodeIist(0).InnerText, fileName)
        
'*************************************************
          Dim fileDetail As System.IO.FileInfo = My.Computer.FileSystem.GetFileInfo(filePath)

        If (fileDetail.IsReadOnly  AndAlso System.IO.File.Exists(filePath)) Then
           	System.IO.File.SetAttributes(filePath, System.IO.FileAttributes.Normal)
        End If

    '*********************************************************
         'Load the RTF file
         ReportUtilities.SetRTFControl(rpt,"Detail1","txtScopeofWork",filePath)

Hope it helps.
__________________
Narayana Karthik
nkarthick is offline   Reply With Quote
Old 06-24-2009, 02:25 PM   #3 (permalink)
CrystalHacker
Guest
 
Posts: n/a
Default

Thanks nkarthick!

I saw the SetAttributes method in my searching, but was not sure how to apply it properly.

I took your advice and now use a hidden field (dtr:ProjectFolder) to establish a path to the project folder. It works great.

-ch
  Reply With Quote
Old 06-24-2009, 10:49 PM   #4 (permalink)
CrystalHacker
Guest
 
Posts: n/a
Default

Yep, worked great. If it was set to ReadOnly I set it back at the end of the report as well.

Thanks again.

-ch
  Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to "Include" an RTF file in a report? CrystalHacker Reports and Reporting Center 11 12-10-2010 12:28 AM
OpenDNS and unable to find LanSync Padwerx Installation & Setup 2 10-25-2009 05:13 AM


All times are GMT. The time now is 08:49 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.0
D-Tools, Inc.