通过代码把word文档转换为html页面文件,字体和格式基本没变化(只是少了分页信息)。但是用浏览器打印或打印预览该文档时,字体却会变小,使打印结果比原始word出现一点差异,怎样解决呢?
解决方案 »
- 自绘菜单有时出现选择错位的问题
- 如何调用远程机子上的COM接口
- 用ADO连接一个加密了的ACCESS数据库,用户名那里填什么呢?
- 请教:对话框问题!
- 请教一个小程序,去不知如何编译
- 望各位大虾出手相助,谢谢!!
- 各位高手,小弟想要把一个类似chm程序显示窗口中的文本拷贝到一个新建的文本文件中,简单说是想简化手工拷贝粘贴功能,不知哪位大虾见告
- GetWindowLong(HWND hwnd,int nindex),nindex= 0表示取什么属性?
- 高分请教: 如何在Word工具栏中添加一按钮?
- 如何实现钩子(Hook)?
- 为什么对话框程序的OnEraseBkgnd总是没有执行???
- 在使用SkinMagic Toolkit美化界面的时候出现拉问题,帮我看看
TFileTimeType = (fttCreation, fttLastAccess, fttLastWrite);
//分别对应文件创建时间,访问时间,修改时间
function GetFileDateTime(const FileName: string; FileTimeType: TFileTimeType): TDateTime;
var
Handle: THandle;
FindData: TWin32FindData;
LocalFileTime: TFileTime;
DosDateTime: Integer;
begin
Handle := FindFirstFile(PChar(FileName), FindData);
if Handle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(Handle);
if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
begin
case FileTimeType of
fttCreation:
FileTimeToLocalFileTime(FindData.ftCreationTime, LocalFileTime);
fttLastAccess:
FileTimeToLocalFileTime(FindData.ftLastAccessTime, LocalFileTime);
fttLastWrite:
FileTimeToLocalFileTime(FindData.ftLastWriteTime, LocalFileTime);
end;
if FileTimeToDosDateTime(LocalFileTime, LongRec(DosDateTime).Hi,
LongRec(DosDateTime).Lo) then
begin
Result := FileDateToDateTime(DosDateTime);
Exit;
end;
end;
end;
Result := -1;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
if self.OpenDialog1.Execute then
ShowMessage(DateTimeToStr(GetFileDateTime(self.OpenDialog1.FileName,fttLastWrite)));
ShowMessage(DateTimeToStr(GetFileDateTime(self.OpenDialog1.FileName,fttLastAccess)));end;
procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var
r: TRect;
i: Integer;
begin
with ListView1.Canvas do
if cdsSelected in State then begin
Brush.Color := clRed;
r := Item.DisplayRect(drLabel);
// Item
FillRect(r);
TextOut(r.Left+2, r.Top, Item.Caption);
// SubItem
for i := 0 to Item.SubItems.Count - 1 do begin
ListView_GetSubItemRect(ListView1.Handle, Item.Index, i+1, LVIR_LABEL, @r);
FillRect(r);
TextOut(r.Left+5, r.Top, Item.SubItems[i]);
end;
DefaultDraw := False;
end;
end;
begin
FBkBmp:=TBitmap.Create;
FBkBmp.LoadFromFile(''''D:\Shuzi\Resource\图标\背景\Gone Fishing.bmp'''');
FBKBmp.Transparent:=True;
end;procedure TForm1.FormDestroy(Sender: TObject);
begin
FBkBmp.Free;
end;procedure TForm1.ListView1CustomDraw(Sender: TCustomListView;
const ARect: TRect; var DefaultDraw: Boolean);
begin
Sender.Brush.Bitmap:=FBkBmp;
Sender.Canvas.Brush.Bitmap:=FBkBmp;
Sender.Canvas.FillRect(ARect);
end;
procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
var
i,x:integer;
Images:TCustomImageList;
R:TRect;
begin
with Sender as TListView do
begin
if ViewStyle=vsIcon then
Images:=LargeImages
else
Images:=SmallImages;
if Images<>nil then
begin
R:=Item.DisplayRect(drIcon);
ImageList_DrawEx(Images.Handle, Item.ImageIndex, Canvas.Handle,
R.Left+(R.Right-R.Left-Images.Width) div 2,
R.Top+(R.Bottom-R.Top-Images.Height) div 2,0, 0,
clNone, clNone, ILD_Transparent); end;
R:=Item.DisplayRect(drLabel);
if cdsSelected in State then
begin
Canvas.Brush.Style := bsSolid;
SetTextColor(Canvas.Handle,clWhite);
SetBkColor(Canvas.Handle,clNavy);
SetBkMode(Canvas.Handle,Windows.OPAQUE);
Canvas.TextRect(R,R.Left,R.Top,Item.Caption);
if RowSelect and (ViewStyle=vsReport) then
begin
R:=Item.DisplayRect(drBounds);
R.Left:=R.Left+Columns[0].Width;
Canvas.Brush.Color := clNavy;
Canvas.FillRect(R);
end;
end
else
begin
Canvas.Brush.Style:=bsClear;
SetBkMode(Canvas.Handle,Windows.TRANSPARENT);
Canvas.TextRect(R,R.Left,R.Top,Item.Caption);
end;
if ViewStyle=vsReport then
begin
Canvas.Brush.Style:=bsClear;
SetBkMode(Canvas.Handle,Windows.TRANSPARENT);
R:=Item.DisplayRect(drBounds);
X:=R.Left+Columns[0].Width+Item.Indent;
for i:=0 to Item.SubItems.Count-1 do
begin
Canvas.TextRect(R,X,R.Top,Item.SubItems[i]);
X:=X+Columns[i+1].Width+Item.Indent;
end;
end;
DefaultDraw:=False;
end;
end;