Formda İki Yana Yasla?
Tarih
30/01/2010 00:01
Konu Sahibi
mavzer_as
Yorumlar
5
Okunma
1986
Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 5
  • 4
  • 3
  • 2
  • 1

Derecelendirme: 0/5 - 0 oy



mavzer_as
Hesap Aktif Değil
Kullanici Avatari
Aktivasyon Bekleyen
18
5
10/02/2009
Adana
Ofis 2003
12/10/2010,10:33
Çözüldü 
Formda TextBox da ki veriyi iki yana yaslama nasıl yapılır. Konu ile ilgili raporlarda iki yana yaslama var ama onuda çözemedim hiçbir örneği çalıştıramadım. Runtime 75 hatası veriyor.
Cevapla


benremix
Uzman
Kullanici Avatari
Uzman
R.... S....
4.431
17/05/2009
365
Ankara
Ofis 2010
Dün,21:35
Çözüldü 
Sn mavzer-as sorun yeterince açık değil, örnek çalışma yok. Başka Access dosyalarını açabiliyormusun? Saygılar...
Bilgi paylaşıldıkça çoğalır....
Her engel, yaşam koşullarınızı daha iyileştirecek bir fırsattır.


Access için her zaman lazım olacak konu başlıkları listesi 


Cevapla


Puletin
Uzman
Kullanici Avatari
Uzman
1.716
01/11/2008
416
Ülke Dışı
Ofis 2003
29/10/2016,20:35
Çözüldü 
PolSoft Final 

Sn.Sledgeab ın çalışmasında bulunan örneklere bir göz atınız.
Kaplumbağa ya dikkat et...
Sadece başını çıkartıp risk aldığında ilerleyebiliyor...
Cevapla


mavzer_as
Hesap Aktif Değil
Kullanici Avatari
Aktivasyon Bekleyen
18
5
10/02/2009
Adana
Ofis 2003
12/10/2010,10:33
Çözüldü 
evet örneği inceledim ama çok detaylı bana lazım olan sadece dahili olarak modül kullanarak form üstündeki text kutusuna girilen verinin iki yana yaslanması otomatik olarak.
aslında clsJustifyText modülü var yazmışlar ama ben nasıl kullanacağımı bilmiyorum. indirdiğim örneklerdede anlamak bi tarafa çalıştıramadım bile.
Kod şu şekilde:

Kod:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
' *************NOTE************* '
' ****THIS IS A CLASS MODULE**** '
' ****NOT A STANDARD MODULE***** '
' *************NOTE************* '


' Class clsJustifyText

Option Compare Database
Option Explicit


Private Type udtPrtMips_str
  strRGB As String * 28
End Type

' Structure from ADH97
Private Type udtPrtMips
  lngLeft As Long
  lngTop As Long
  lngRight As Long
  lngBottom As Long
  lngDataOnly As Long
  lngWidth As Long
  lngHeight As Long
  lngDefaultSize As Long
  lngItemsAcross As Long
  lngColumnSpacing As Long
  lngRowSpacing As Long
  lngItemLayout As Long
  lngFastPrinting As Long
  lngDataSheet As Long
End Type


' Arrays to hold the info we require from
' processing the Report's Detail Event
Private lngTop() As Long
Private lngCtlLeft() As Long
Private varData() As String
Private lngHeight() As Long
Private lngCtlHeight() As Long
Private tokens() As String
Private strCtlName As String

' We need the Filenumber/handle visible to
' several subs.
Dim m_FileNumber As Integer



Public Function fJustiDirect(rpt As Report) As Boolean
'Author:        Stephen Lebans
'Date:          January 23, 2000
'Time:          11:24:05 PM
'Name:          fJustiDirect
'Version:       3.11
'Calls:         VBA Calls only
'Purpose:       To allow Fully Justified Text
'               in a standard Access TextBox control.
'               Specifically for a Bound Memo field
'               in a Report.
'Copyright:     Lebans Holdings 199 Ltd.
'Why:           I have already produced an ActiveX control
'               to allow for Fully Justified Text.
'               Unfortunately, ActiveX controls do not
'               work within the Access CanGrow/CanShrink
'               functionality available in Reports. :-(
'
'Credits:       Pedro Gil. Code to allow for International use.
'               In the interest of World Peace! :-)
'
'How it works:
'Create a TextBox control and bind it to your data field.
'Setup the control's Font, Color, and Border properties as
'would normally.
'****CHANGE THE FONT COLOR TO WHITE***********************
'We have to do this because we are going to use the
'Report Object's Print method to draw onto the TextBox control.
'By doing it this way we effectively bypass the CanGrow/CanShrink
'property problems. There is 1 caveat. Access resizes the control
'based on the current font's settings. If you increase the margin
'setting too much you are effectively reducing the area in the control
'we have available for us to draw in. Access doesn't know we are doing
'this. To get around this you can set a Font Size smaller than that
'of the TextBox control.
'


'How to Use this Function:
'The functions contained in this module must be called directly
'from the Report's Class Module.

' At the very top of your Form's Class module,
' in the General Declarations area you must declare
' as many instances of the clsJustifyText as you require.
' Obviously one instance for each Control where you want the
' output text to be fully justified.

' **Code Start General Declaration Area
'Dim Justi1 As New clsJustifyText
'Dim Justi2 As New clsJustifyText
' ** Code End


'The fRecordDetail function is called from your Report's
'Detail Print event. The only thing different from the following
'example is that you must supply the name of your MEMO control(s).
'In this example there are 2 named "txtTestmemo" and "txtTestmemo2".
'
'**********************
'Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'Call Justi1.fRecordSection(Me, txtTestmemo, PrintCount )
'Call Justi2.fRecordSectionDetail(Me, txtTestmemo2, PrintCount)
'End Sub
'**********************
'
'The final function you must call directly from your
'Report's Class Module is fJustiDirect. You will be using
'your Report's On Page event. Make it look exactly
'like the following example. You don't have to change
'anything because the only argument required is the
'Report object itself. Since we are calling the function
'directly from your Report's Class Module we can simply
'use "Me"  to refer to the Report Object.

'**********************
'Private Sub Report_Page()
'Dim myBool As Boolean
'myBool = Justi1.fJustiDirect(Me)
'myBool = Justi2.fJustiDirect(Me)
'End Sub
'**********************
'
' Finally you need to Clean up!
' We do this in the Report's Close event
'Private Sub Report_Close()
'Set Justi1 = Nothing
'Set Justi2 = Nothing
'End Sub
'
'
'That's it. I tried to make it easy to use! :-)
'
'
'Caveats:
' Poor/nonexistent Error Handling. :-(
'
' Needs autohyphenation logic to handle
' single words that do not fit on on eline.
'
'Program Logic
' I just converted the code from a Standard module
' into a Class Module to allow for
' multiple Control's on the same Report.
' The code really needs a redesign from
' scratch but it would be a lot of work.
' It works in its present incarnation and I
' want to get back to the new projects I
' am working on. :-)
'
'COPYRIGHT:
'Please feel free to use these functions in your
'own code. There are no license restrictions other
'than you cannot sell these functions by
'themselves or as part of a collection.
'
'
'Enjoy
'Stephen Lebans
'Copyright Lebans Holdings 1999 Ltd
'Email: Stephen@lebans.com
'Wed site: www.lebans.com


' Let's get started!
' This is the main entry point for the function.
' Here we break up the string data we have
' recalled/stored in the array VarData().
' So first we break up the string into Tokens,
' then we print each token/word individually to allow
' us to calculate and add the correct amount
' of space to achieve full text justification.

' Remember the array varData() is filled when
' we call the fRecordDetail function from the
' Report's Detail )Print event.
'Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
'Call Justi1.fRecordDetail(Me, "testmemo", PrintCount)

' intSections holds how many rows in the
' Detail Section for this current page.
Dim intSections As Integer

' If this section's KeepTogether prop causes the section to begin on
' the next page then we need to exit!
On Error Resume Next
Dim s As String
s = varData(0)
If (Len(s & vbNullString) = 0) Then Exit Function

For intSections = 0 To UBound(varData()) - 1
    'Call FTokenize to parse/break up the string
    Call fTokenize(Nz(varData(intSections), " "))
    Call fPrintData(rpt, lngTop(intSections), lngCtlLeft(intSections), _
    lngHeight(intSections), lngCtlHeight(intSections))
Next intSections

'CLEANUP
ReDim lngTop(0)
ReDim lngCtlLeft(0)
ReDim varData(0)
ReDim lngHeight(0)
ReDim lngCtlHeight(0)
End Function


Private Sub fTokenize(InputString As String)
Dim strTemp As String
Dim strChar As String
Dim X As Long

'initialize vars
ReDim tokens(0)
strTemp = ""


X = 1
Do ' While Mid(InputString, 1, 1) <> ""
    strTemp = strTemp & Mid(InputString, 1, 1)
    strChar = Mid(InputString, 1, 1)
    
    Select Case strChar
      
      
    ' Char = Space
    Case " "
    tokens(UBound(tokens)) = Trim(strTemp)
    ReDim Preserve tokens((UBound(tokens()) + 1))
    InputString = Right(InputString, Len(InputString) - 1)
    ' reset strTemp
    strTemp = ""
        
        
    ' Char = ""  zero length string = EOF
    ' We are at the end of the string.
    ' Output previous line if any.
    ' Still increase bounds on Array so that
    ' it is always 1 more than actual.
    Case ""
    If Len(strTemp) > 0 Then
    tokens(UBound(tokens)) = strTemp
    ReDim Preserve tokens((UBound(tokens()) + 1))
    End If
    
    
    ' Char = CR.
    ' Advance string pointer 2 chars for vbCrLf
    ' Output previous line if any
    ' Output blank line
    Case vbCr
    If Len(strTemp) > 0 Then
    tokens(UBound(tokens)) = Left(strTemp, Len(strTemp) - 1)
    ReDim Preserve tokens((UBound(tokens()) + 1))
    End If
    ' Add a CR to the Token array
    tokens(UBound(tokens)) = vbCrLf '"CR"
    ReDim Preserve tokens((UBound(tokens()) + 1))
    ' Advance past vbCrLf -> 2 chars
    InputString = Right(InputString, Len(InputString) - (2))
    X = X + 1
    ' reset strTemp
    strTemp = ""
    
        
    ' Char = character. Do nothing. Advance string pointer
    Case Else
    InputString = Right(InputString, Len(InputString) - 1)
    
    End Select
    'Setup as Select Case to allow for future handling of Tabs
    'and possible formatting features
    
 X = X + 1
 Loop While strChar <> ""

End Sub


Private Sub fPrintData(rpt, intSectionTop, intCurCtlLeft, intSectionHeight, intlngCtlHeight)

' Need to save current Report settings
Dim oldFontName As String
Dim oldFontSize As Integer
Dim oldFontBold As Integer
Dim oldFontItalic As Integer
Dim oldForeColor As Long


' OK so it's kind of messy and maybe the var names
' could be slightly more descriptive/accurate.
' Remember this grew out of one frantic
' night of programming...give me a break.
'

' Calculate Margins
Dim MIPSstr As udtPrtMips_str
Dim MIPS As udtPrtMips
Dim varBMargin As Variant
Dim varTMargin As Variant
Dim lngLineSpaceing As Long
Dim lngExtraSpace As Long
Dim lngNumWords As Long
Dim lngLineWidth As Long
Dim lngMargin As Long
Dim lngMarginTop As Long
Dim CtlCurrent As Control
Dim startY As Long

' My junk
Dim strTemp As String
Dim Ypos As Long
Dim X As Long
Dim y As Long
Dim LngRet As Long

' Is char a CR
Dim boolCR As Boolean
' Is char End of File
Dim boolEOF As Boolean

' Store heights of
' Page Header and Footer Sections
Dim lngPageFooterHeight As Long
Dim lngPageHeaderHeight As Long

Dim strLocale As String * 2

' Flag to signfify if this
' Section has been continued from
' the previous page.
Static blHasContinued As Boolean

' Counters to kep track of number of words
' we are outputting.
Static LngTokenX As Long
Dim lngNumTokens As Long


' Let's get started
' Uhh..Global Variable..strCtlName
Set CtlCurrent = rpt.Controls(strCtlName)

' Will generate error if no PageHeader
On Error Resume Next
lngPageHeaderHeight = Nz(rpt.Section(acPageHeader).Height, 0)
' Will generate error if no PageFooter
lngPageFooterHeight = Nz(rpt.Section(acPageFooter).Height, 0)

' April 15 mods to allow the use of PageHeader and PageFooter sections
' to contain JustiDirect controls
' April 16 - PageHeader and PageFooter do not support CanGrow/CanShrink

' If CtlCurrent resides in the PageHeader section then set the
' lngPageHeaderHeight var to zero.
'If CtlCurrent.Section = acPageHeader Then lngPageHeaderHeight = 0

' If CtlCurrent resides in the PageFooter section then set the
' lngPageFooterHeight var to zero.
'If CtlCurrent.Section = acPageFooter Then lngPageFooterHeight = 0



' Calculate how many words/tokens can fit on one line
' and then add justification to the space between
' the words.

' I had originally used the GetLocaleInfo API
' to calculate the page margins. Pedro Gil was
' kind enough to send me the code to
' internationalize the process.

' Get Page margins in TWIPS
MIPSstr.strRGB = rpt.PrtMip
LSet MIPS = MIPSstr
varBMargin = MIPS.lngBottom
varTMargin = MIPS.lngTop


'Save current Font settings in report
oldFontName = rpt.FontName
oldFontSize = rpt.fontsize
oldFontItalic = rpt.FontItalic
oldFontBold = rpt.FontBold
oldForeColor = rpt.ForeColor

'Copy CtlCurrent's Font settings to Reports
With CtlCurrent
rpt.FontName = .FontName

' See my post on www.deja.com
' for the logic behind this FontBold issue.
If .FontBold = 1 Then
    rpt.FontBold = True
Else:
    rpt.FontBold = False
End If
 
' If you need to set larger Margins then use
' one size less so that even with justified text
' we will still fit within Control's boundaries.
rpt.fontsize = .fontsize '- 1
rpt.FontItalic = .FontItalic
rpt.ForeColor = 0 'BLACK
End With

'Scale to TWIPS - just in case
rpt.ScaleMode = 1

'Set Margin
'If you set the margin too large then the text will not
'fit in the control. Remember, the control is being resized
'by Access as per it's normal printing paramters. By adding
'a margin we are reducing the area of the control we can print
'into. To get around this, decrease the size of the font
'we are using. Subtract 1 from the fontsize.
'I have left commented out code in for this purpose.

' *****WARNING*****
' Be very careful adjusting this Margin.
' If text starts to run into the Next
' section subtract one from the Font Size as
' explained in the paragraph above.
' Expressed in TWIPS
lngMargin = 12
lngMarginTop = 10
'Calculate Linespacing
' Need to allow for Margin Access leaves at bottom
' of the Control. Also Access will not print the
' very last line of a Control if there is not enough
' room for the entire character, including descender
' and its built in margin.
' Need more work on lngLineSpaceing.
lngLineSpaceing = rpt.TextHeight(" ")
' Add some FUDGE to the Factor
lngLineSpaceing = CInt(lngLineSpaceing * 1.02)
' Setup our first horizontal position
rpt.CurrentX = intCurCtlLeft + lngMargin

'****************************************************
' WARNING LOGIC FAILURE :-)
'****************************************************

' Gotcha - Must first check and see if
' intSectionTop + ctlcurrent.height fits on the page
' with room for the footer if any. If KeepTogether = YES
' then we can have a gap at the bottom of this page.
' A print Event is generated, but if you check
' the values of intSectionTop and Ctl.Height you'll
' see that it can't possibly fit in this space.
' Not even partially. THis is the difference between
' a normal willcarryover event of the last detail section row
' where the control will partially fit

' Still having trouble understand the Cutoff point as to exactly
' when Access will not use the blank space at the bottom of
' the page between the LastRow of the Detail Section and the
' Page Footer. I've set it to 2 lines of text- Let's try that.
'If rpt.ScaleHeight - lngPageFooterHeight < CtlCurrent.Height + (intSectionTop) Then
' No this seems to work all of the time
If intSectionHeight < CtlCurrent.top + lngLineSpaceing Then
Exit Sub
End If


' There is a problem when Print Previewing and
' then going directly to physical PRINTING.
' If the last Page Print Previewed produces
' a blHasContinued = TRUE condition this
' is NOT RESET for Page 1 when it is output.
 If rpt.Page = 1 Then blHasContinued = False

' Not a Has Continued Section - Normal Processing
' Should always be a Negative is HasContinued =TRUE
' but sometimes it isn't..go figure! Get around it by
' setting our own FLAG -> blHasContinued
'If intSectionTop > 0 Then
If blHasContinued = False Then

    rpt.CurrentY = (intSectionTop + lngMarginTop + CtlCurrent.top) - varTMargin
    blHasContinued = False
    If rpt.CurrentY < 0 Then Exit Sub
Else:
    rpt.CurrentY = lngPageHeaderHeight + lngMarginTop
    ' init starting YPosition
    blHasContinued = True
End If

Ypos = rpt.CurrentY
'Debug.Print "YPos at top of code:" & Ypos

' Jan 24/2000
' trying to fix error that occurs if adjacent memo field
' causes a Print Event to occur for a HasContinued Area
' and really this Memo field is completely outputted
' CUrrently 1 line is printing before sub exits
' If Ypos < 0 Then Exit Sub
' PUT IT A FEW LINES ABOVE WHERE IT BELONGS
' IN TEST OF blHasCOntinued

lngNumWords = 0
X = 0

' Total number of words to output
lngNumTokens = UBound(tokens) - 1
 If lngNumTokens < 0 Then Exit Sub
' Initialize temp string
strTemp = ""
   
' ***Main Loop***
' Is HasContinued Flag = True
' Then we need to finish printing from last page
If blHasContinued = True Then
    blHasContinued = False
    X = LngTokenX
End If
Do While X <= lngNumTokens
        rpt.CurrentX = intCurCtlLeft + lngMargin
        
        Do While lngLineWidth < CtlCurrent.Width - (lngMargin * 2)
            If lngNumWords <> 0 Then
                strTemp = strTemp & " " & tokens(X)
            Else:
            strTemp = strTemp & tokens(X)
            End If
            If tokens(X) = vbCrLf Then
                X = X + 1
                Exit Do
            End If
            
            lngLineWidth = rpt.TextWidth(strTemp)
            lngNumWords = lngNumWords + 1
            If X >= lngNumTokens Then
                ' Jan 23 try this to handle losing first word
                ' when all of the words fit on one line except for
                ' the last word
                If lngLineWidth > CtlCurrent.Width - (lngMargin * 2) Then
                    'lngNumWords = lngNumWords + 1
                    Exit Do
                End If
                ' Jan  23 sunday commnet out
                ' next line x = x +1
                ' losing first word
                X = X + 1
                Exit Do
            End If
            
            If lngLineWidth > CtlCurrent.Width - (lngMargin * 2) Then Exit Do
            
            X = X + 1
        Loop
    
    ' The Token Counter x is advanced if we had just hit a
    ' vbCrLf.
    ' If our string has exceeded our Control's Width
    ' then the Counter X is not advanced which effectively
    ' prunes off the last token(word) concanentated to
    ' our ourput temp String.
    
    ' This gives us the automagic advance we need on this counter
    ' to loop back to the top of this procedure and continue on.
    
    ' If we get to here than either we've exceed linelength
    ' or we've hit a CR, or  we are all done
    ' Also add error handling if 1 word is too long.
    ' Just throw word away and Substitute "*..* for now.
    ' Needs Autohyphenation logic
    If lngLineWidth > CtlCurrent.Width - (lngMargin * 2) Then
        If lngNumWords = 1 Then
            strTemp = "*..*  "
            tokens(X) = strTemp
            X = X + 1
        End If
    End If
    
    If tokens(X - 1) = vbCrLf Then boolCR = True Else boolCR = False
    ' If this is the end of the string output with no justification.
    ' Need to revisit this line of code before and add criteria
    ' to handle last line of the Control where everything fits
    ' except the very last word. We really don't want boolEOF set
    ' as we need to comeback and print the last word.
    If X >= lngNumTokens Then boolEOF = True Else boolEOF = False
    
    ' Time to output a line.
    ' If we've exceeded line length then remove last word
    ' in strTemp. Do this by rebuilding string from tokens()
    If CtlCurrent.Width - (lngMargin * 2) < rpt.TextWidth(strTemp) Then
        strTemp = ""
        For y = ((X) - (lngNumWords - 1)) To (X - 1)
            strTemp = strTemp & tokens(y) & " "
        Next y
        lngNumWords = lngNumWords - 1
        '****************
        'x = x - 1
    End If
    
    'trim trailing spaces
    strTemp = RTrim(strTemp)
    
    'If last token was a CR or EOF then output line without justification
    If boolCR Or boolEOF Then
        'Is CR on line by itself?
        If lngNumWords = 0 Then
            'Forget it..do nothing!
            'ypos = rpt.CurrentY
            'rpt.Print ""
            'rpt.CurrentY = Ypos
            
        Else:
            If boolCR Then
            'prune off last two chars, vbCrLf
            Ypos = rpt.CurrentY
            rpt.Print Left$(strTemp, Len(strTemp) - 2)
            rpt.CurrentY = Ypos
            Else:
            Ypos = rpt.CurrentY
             rpt.Print strTemp
            rpt.CurrentY = Ypos
            End If
        End If
    End If
    
    If Not boolCR Then
        If Not boolEOF Then
        ' Calculate Justification
        ' cheesy error handling for divide by zero
        ' it's late and I'm going to bed! :-)
        
        lngExtraSpace = (CtlCurrent.Width - (lngMargin * 2) - rpt.TextWidth(strTemp)) \ IIf(lngNumWords < 2, lngNumWords, (lngNumWords - 1))
        'Output the current tokens. Add spaces between words
        For y = ((X - 1) - (lngNumWords - 1)) To (X - 1)
            strTemp = tokens(y) & " "
            Ypos = rpt.CurrentY
            
            'Debug.Print "YPos at PRINTING:" & Ypos
            rpt.Print strTemp
            rpt.CurrentY = Ypos
            rpt.CurrentX = rpt.CurrentX + lngExtraSpace
        Next y
    
    'Done printing this line
        End If
    End If
    
    'Are we all done?
    If X > lngNumTokens Then
    blHasContinued = False
    ' Should add some cleanup and var reset code here
    ' even though everything seems OK.
    Exit Sub
    End If
    
' Need error checking to make sure we haven't exceeded height of control
rpt.CurrentY = rpt.CurrentY + lngLineSpaceing
'If rpt.CurrentY >= intSectionTop + intSectionHeight Then Exit Do 'rpt.height
'If rpt.CurrentY >= (intSectionTop + lngMarginTop + intSectionHeight) - _
'(varBMargin + CtlCurrent.Top) Then

' Need to check and see if ctl height is greater than section
' this signifies that WillContinue is TRUE.
' SO we need to store each control's height in another array.
' Also change these damn names to match should be intSectionHeight

' We need to determine if this section will be carried over to next
' Check ctl vs section height
' For access 97 if Ctl.Height > Section>height than WillContinue = TRUE
' intBOSection = .ScaleHeight - intpagefooter
If intSectionHeight < intlngCtlHeight Then
   
   ' Jan 20/200 just changed 20 to textheight
   If rpt.CurrentY >= rpt.ScaleHeight - (lngPageFooterHeight + CtlCurrent.top + lngMarginTop + (rpt.TextHeight("jI") / 2)) Then
   ' If rpt.CurrentY >= rpt.ScaleHeight - (lngPageFooterHeight + CtlCurrent.Top + lngMarginTop + 20) Then
            
        ' OK now save position of last Token processed
        ' and Set FLAG to tell us HasContinued
        blHasContinued = True
        LngTokenX = X ' Jan.21 2000 + 1
        Exit Do
    End If
End If

' Setup pur next horizontal position
rpt.CurrentX = intCurCtlLeft + lngMargin
' Reset vars for Loop
lngNumWords = 0
strTemp = ""
lngLineWidth = 0
boolCR = False
boolEOF = False

'Jump back and resume Main Loop
Loop

'CLEANUP
'Restore Reports original Font settings
With rpt
rpt.FontName = oldFontName
rpt.FontBold = oldFontBold
rpt.fontsize = oldFontSize
rpt.FontItalic = oldFontItalic
rpt.ForeColor = oldForeColor
End With

' Final Cleanup
Set CtlCurrent = Nothing

End Sub


Public Sub fRecordSection(rpt As Report, ctl As Access.TextBox, PrintCount)
' Records all of the required data for the
' pertinent Control's during the Detail Print Event.
' Called from the Report's Detail Print Event.


' Module level variable.
' Couldn't figure any other way to do it cleanly.
strCtlName = ctl.Name

Dim ctlTemp As Control

On Error Resume Next

'***********
'FIND A GOOD PLACE TO INITIALIZE DATA
If IsNull(lngTop(0)) Then
ReDim lngTop(0)
ReDim lngCtlLeft(0)
ReDim varData(0)
ReDim lngHeight(0)
ReDim lngCtlHeight(0)
End If

For Each ctlTemp In rpt.Section(ctl.Section).Controls
    With ctlTemp
        If ctlTemp.Name = ctl.Name Then
                
        lngCtlLeft(UBound(lngCtlLeft)) = .Left
        lngTop(UBound(lngTop)) = rpt.top
        'Debug.Print "Section Top:" & rpt.Top
        varData(UBound(varData)) = rpt.Controls(ctl.Name)
        lngHeight(UBound(lngHeight)) = rpt.Height
        lngCtlHeight(UBound(lngCtlHeight)) = .Height
        
        'Debug.Print "Ctl Height:" & .Height
        'Debug.Print "Section Height:" & rpt.Height
        'Debug.Print Left(rpt.Controls(ctlname), 30)
        ReDim Preserve lngTop(UBound(lngTop) + 1)
        ReDim Preserve lngCtlLeft(UBound(lngCtlLeft) + 1)
        ReDim Preserve varData(UBound(varData) + 1)
        ReDim Preserve lngHeight(UBound(lngHeight) + 1)
        ReDim Preserve lngCtlHeight(UBound(lngCtlHeight) + 1)
        End If
    End With
Next

' Clean up
Set ctlTemp = Nothing

End Sub


Private Sub Class_Initialize()
' Get next Free File Number
 m_FileNumber = FreeFile
 
' Allow for multiple instances of this Class
Open "c:\Reportlog" & m_FileNumber & ".txt" For Output As #m_FileNumber

End Sub

Private Sub Class_Terminate()
Close #m_FileNumber
End Sub


Public Sub PrintSectionLog(rpt As Access.Report, SectionCtl As Object)
' Creates a Profile Report Log of
' the Report's Sections and Controls.
' Used to Debug Positioning problems and see just
' what logic Access uses when working with
' CanGrow/CanShrink, Keep Together, & Has Continued logic.
' Called from Report Class module ie:
' Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' If PrintCount = 1 Then
' Call Justi1.PrintSectionLog(Me, Me.Section(acDetail).Controls(1))
' End If
' End Sub
'
' You must call this function from every Report Section's Print event
' that you have on your Report. Except for the Detail Section you must
' specify directly the Control you are passing.
' For example:
' Call Justi1.PrintSectionLog(Me, Me.LblCustomerIDFooter)
' The SectionCtl must be declared as Object to accomodate
' all of the possible Control/Object types
' that may be passed.

Dim ctl As Control
Dim sect As Section

' We need the current Section to enumerate
' through it's Control's Collection
Set sect = rpt.Section(SectionCtl.Section)

' We only want to Print our Page Header
' at the Top of each page of the
' Log Report we generate.
Static CurPage As Long

If CurPage <> rpt.Page Then

' First time through on this page.
' Let's Print our Log Report Page Header Info.
Print #m_FileNumber, " "
Print #m_FileNumber, " "
With rpt
Print #m_FileNumber, "**REPORT**"; Tab; "REPORT NAME:"; .Name; Tab; "PAGE#:"; rpt.Page; " of:"; rpt.Pages
Print #m_FileNumber, '---------------------------------------------------------------------------------""
Print #m_FileNumber, "ScaleHeight:"; Tab; "Report Height:"; Tab; "ScaleTop:"; Tab; "Top:"
Print #m_FileNumber, .ScaleHeight; Tab; .Height; Tab; Tab; .ScaleTop; Tab; .top
End With

End If
' We've printed our Log Report Page Header
' Make sure we don't print it again until
' we hit the next page.
CurPage = rpt.Page

' Seperator  Spaces
Print #m_FileNumber, " "
Print #m_FileNumber, " "

' Print Section Details
With sect
Print #m_FileNumber, "----------------------------------------------------------------------------------"
' Note that rpt.Top is actaully this Section's TOP property. **important**!
Print #m_FileNumber, "**SECTION**"; Tab; "SECTION NAME:"; .Name; Tab; "Section Height:"; .Height; Tab; "S.Top:"; rpt.top
End With
Print #m_FileNumber, "----------------------------------------------------------------------------------"

' Enumerate Section's Control Collection
Print #m_FileNumber, "**SECTION CONTROLS**"

Print #m_FileNumber, Tab(30); "Width:"; Tab; "Height:"; Tab; "Top:"
For Each ctl In sect.Controls
    With ctl
        Print #m_FileNumber, Left(.Name, 28); Tab(30); .Width; Tab; .Height; Tab; .top
    End With
Next
' Seperator for this Section
Print #m_FileNumber, "**********************************************************************************"

' Cleanup - Set all objects to Nothing
Set sect = Nothing
Set ctl = Nothing

End Sub


şimdi bunu form üzerinde nasıl kullanırım bilgisi olan arkadaşlar bir bakarsa sevinirim. zira bu konuda dün gecen beri baktım tam olarak açıklayıcı bir bilgi yok.

Cevapla


ozanakkaya
sledgeab
Kullanici Avatari
Kurucu
O.... A....
9.013
29/01/2008
Denizli
Memur
Ofis 2010 32 Bit
Çözüldü 
ekteki Lebans'ın örneğini inceleyiniz.

bu uygulamanın çalışabilmesi için rtf2.ocx'in system32 ye eklenmesi ve accesse kaydedilmesi gerekmekte. Polsoft'u kurduysanız bu işlemler yapılmıştır.


Ek Dosyalar
.zip   A2K RTF2 Sample Release 5-5.zip (Dosya Boyutu: 70,16 KB / İndirme Sayısı: 55)
Cevapla


mavzer_as
Hesap Aktif Değil
Kullanici Avatari
Aktivasyon Bekleyen
18
5
10/02/2009
Adana
Ofis 2003
12/10/2010,10:33
Çözüldü 
Evet sonunda oldu tabi. ama işin kötü tarafı rtf2.ocx devaml yanında taşımak lasım Img-grin. neyse yardım eden arkadaşlara teşekkürler.
Cevapla







Konuyu Okuyanlar: 1 Ziyaretçi


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Tarih Son Yorum
  Formda İsim yazdığımda tablodan veri gelmesi 53rize 6 153 27/11/2016, 13:36 53rize
  Access Formda Tümünü Seç Buton Olay Yordamı Ekleme ? mehami 7 294 25/11/2016, 18:36 mehami
  Formdaki bir alan göre alt formda alanları gizleme enderya 2 82 20/11/2016, 19:34 ozanakkaya
  Alt Formda Satır Silindiğinde Yeniden Hesaplatmak shalala 2 142 17/11/2016, 09:44 shalala
  Sorgudaki değişime göre formda uyarı vermek mehmetb84 4 140 16/11/2016, 23:08 mehmetb84


Türkçe Çeviri: MCTR, Forum Yazılımı: MyBB, © 2002-2016 MyBB Group.
DMCA.com Protection Status
© Desing by XSTYLED| Develops by ozanakkaya