From 34e9b74b66e82276516881254bea4611a87cea1d Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sat, 13 Mar 2010 17:35:40 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Extended=20Table=20Info=20printing=20-=20se?= =?UTF-8?q?t=20create=20table=20syntax=20string=20temporarily=20to=2010pt?= =?UTF-8?q?=20for=20printing=20-=20before=20gathering=20print=20data=20set?= =?UTF-8?q?=20focus=20to=20createTableSyntaxView=20to=20update=20possible?= =?UTF-8?q?=20pending=20comment=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPExtendedTableInfo.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Source/SPExtendedTableInfo.m') diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 30741424..216057e0 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -372,6 +372,10 @@ */ - (NSDictionary *)tableInformationForPrinting { + + // Update possible pending comment changes by set the focus to create table syntax view + [[NSApp keyWindow] makeFirstResponder:tableCreateSyntaxTextView]; + NSMutableDictionary *tableInfo = [NSMutableDictionary dictionary]; NSDictionary *statusFields = [tableDataInstance statusValues]; @@ -396,7 +400,19 @@ NSArray *HTMLExcludes = [NSArray arrayWithObjects:@"doctype", @"html", @"head", @"body", @"xml", nil]; NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:NSHTMLTextDocumentType, NSDocumentTypeDocumentAttribute, HTMLExcludes, NSExcludedElementsDocumentAttribute, nil]; + + // Set tableCreateSyntaxTextView's font size temporarily to 10pt for printing + NSFont *oldFont = [tableCreateSyntaxTextView font]; + BOOL editableStatus = [tableCreateSyntaxTextView isEditable]; + [tableCreateSyntaxTextView setEditable:YES]; + [tableCreateSyntaxTextView setFont:[NSFont fontWithName:[oldFont fontName] size:10.0]]; + + // Convert tableCreateSyntaxTextView to HTML NSData *HTMLData = [[tableCreateSyntaxTextView textStorage] dataFromRange:NSMakeRange(0, [[tableCreateSyntaxTextView string] length]) documentAttributes:attributes error:&error]; + + // Restore original font settings + [tableCreateSyntaxTextView setFont:oldFont]; + [tableCreateSyntaxTextView setEditable:editableStatus]; if (error != nil) { NSLog(@"Error generating table's create syntax HTML for printing. Excluding from print out. Error was: %@", [error localizedDescription]); -- cgit v1.2.3