❶ 打印网页页面,但是打印出了网页的源代码,打印预览也是显示源代码。怎么打印网页本来的啊
碰到一个问题一样,就是windows 7 64位操作系统,但是打印空白,打印出来像白纸一样!经过查看和总结,确认是:由于保护模式下 %Temp%\Low 文件夹工作不正常引起的!故障打印白纸下面会出现类似:C:\Users\\AppData\Local\Temp\Low\xxxx.htm这样的网页。
原因:这种情况,多半由于保护模式下 %Temp%\Low 文件夹工作不正常引起的(被误删除、移位等等)
解决方法:
(1)重置IE安全级别
(2)在用户模式下,在附件中找到cmd创建low文件,具体命令如下
mkdir %userprofile%\AppData\Local\Temp\Low
ICACLS "%userprofile%\AppData\Local\Temp\Low" /setintegritylevel (OI)(CI)low
如果用户具有管理员权限,请把以下代码保存为bat批处理文件运行:
@ECHO off
If not exist %userprofile%\AppData\Local\Temp\Low (
echo.
echo Creating Low Folder...
mkdir %userprofile%\AppData\Local\Temp\Low
)
echo.
echo Apply Integrity Level...
echo.
ICACLS "%userprofile%\AppData\Local\Temp\Low" /setintegritylevel (OI)(CI)low
exit
总结:这个解决方法可能不是万能的,可能只是针对某些故障的特定方法,不一定适用所有情况,不过也是一个考虑的方向和排除故障的考虑范围。
❷ 谁有java打印的源代码
//参考下吧
import java.awt.*;
import java.awt.event.*;
import java.awt.font.*;
import java.awt.geom.*;
import java.awt.print.*;
import java.util.*;
import javax.print.*;
import javax.print.attribute.*;
import javax.swing.*;
/**
This program demonstrates how to print 2D graphics
*/
public class PrintTest
{
public static void main(String[] args)
{
JFrame frame = new PrintTestFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
/**
This frame shows a panel with 2D graphics and buttons
to print the graphics and to set up the page format.
*/
class PrintTestFrame extends JFrame
{
public PrintTestFrame()
{
setTitle("PrintTest");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
canvas = new PrintPanel();
add(canvas, BorderLayout.CENTER);
attributes = new HashPrintRequestAttributeSet();
JPanel buttonPanel = new JPanel();
JButton printButton = new JButton("Print");
buttonPanel.add(printButton);
printButton.addActionListener(new
ActionListener()
{
public void actionPerformed(ActionEvent event)
{
try
{
PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintable(canvas);
if (job.printDialog(attributes))
job.print(attributes);
}
catch (PrinterException e)
{
JOptionPane.showMessageDialog(PrintTestFrame.this, e);
}
}
});
JButton pageSetupButton = new JButton("Page setup");
buttonPanel.add(pageSetupButton);
pageSetupButton.addActionListener(new
ActionListener()
{
public void actionPerformed(ActionEvent event)
{
PrinterJob job = PrinterJob.getPrinterJob();
job.pageDialog(attributes);
}
});
add(buttonPanel, BorderLayout.NORTH);
}
private PrintPanel canvas;
private PrintRequestAttributeSet attributes;
private static final int DEFAULT_WIDTH = 300;
private static final int DEFAULT_HEIGHT = 300;
}
/**
This panel generates a 2D graphics image for screen display
and printing.
*/
class PrintPanel extends JPanel implements Printable
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
drawPage(g2);
}
public int print(Graphics g, PageFormat pf, int page)
throws PrinterException
{
if (page >= 1) return Printable.NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D) g;
g2.translate(pf.getImageableX(), pf.getImageableY());
g2.draw(new Rectangle2D.Double(0, 0, pf.getImageableWidth(), pf.getImageableHeight()));
drawPage(g2);
return Printable.PAGE_EXISTS;
}
/**
This method draws the page both on the screen and the
printer graphics context.
@param g2 the graphics context
*/
public void drawPage(Graphics2D g2)
{
FontRenderContext context = g2.getFontRenderContext();
Font f = new Font("Serif", Font.PLAIN, 72);
GeneralPath clipShape = new GeneralPath();
TextLayout layout = new TextLayout("Hello", f, context);
AffineTransform transform = AffineTransform.getTranslateInstance(0, 72);
Shape outline = layout.getOutline(transform);
clipShape.append(outline, false);
layout = new TextLayout("World", f, context);
transform = AffineTransform.getTranslateInstance(0, 144);
outline = layout.getOutline(transform);
clipShape.append(outline, false);
g2.draw(clipShape);
g2.clip(clipShape);
final int NLINES =50;
Point2D p = new Point2D.Double(0, 0);
for (int i = 0; i < NLINES; i++)
{
double x = (2 * getWidth() * i) / NLINES;
double y = (2 * getHeight() * (NLINES - 1 - i))
/ NLINES;
Point2D q = new Point2D.Double(x, y);
g2.draw(new Line2D.Double(p, q));
}
}
}
❸ 用C语言实现打印功能的具体代码是什么
打印,这是个大的概念
你要指明你要打印到哪里
一般的“打印”值输出到标准的输出设备(CRT)
如果需要“打印”到其他设备,可以用流的重定向解决这个问题
标准的I/O头文件是stdio.h,里面声明了大部分I/O函数,你可以在那里查阅
满意请采纳,不满意请追问
❹ 学生信息管理系统最简单源代码。
方法一:
1、创建一个c语言项目。然后右键头文件,创建一个Stu的头文件。
❺ 怎么查看安卓源码中的打印信息
编译的时候在终端中一开始就会打印出来
❻ c语言 可以查询近5年的信息的源代码
都世界末日了 兄弟就别交了吧!
工资.txt有啥格式要求不! 没有话你就可以这样写
[2012] 50000 55354
[2011] 45000 45824
[2010] 40002 42563
[2009] 15748 16333
[2008] 35718 36999
要查询2009 那么就写个query(2009)
query(int year )
{
FILE *fd = open("xxx.txt", r);
char buf[1024] = {0};
char years[] = itoa(year);
strcat(years , "]"); //把 2009 变成 “2009]”
fread(buf , 1, 1024 , fd); //那工资全部读出来
char *p = strstr(years , buf); //在buf中找到 2009]”的位置
while(*(p++) != ']')
;//定位到[2009]后面的那个字符
while(*p == ' ')
{
p++;
}//过滤掉[2009]空格
char salary1[10] ;
while ( *p != ' ')
{
*salary1++ = *p++;
}
int s1 = atio(salary //后面的参数不记得了);//得到税前工资
while(*p == ' ')
{
p++;
}//过滤掉sarary1后面的空格
char salary1[10] ;
while ( *p != ' ')
{
*salary2++ = *p++;
}
int s2 = atio(salary //后面的参数不记得了);//得到税前工资
} //大概思路是这样的 , 自己再改改就OK了 细节我就没有注意了
怎么把s1 s2传出去就是你的事了
❼ C++ 打印源代码(控制台)
我有一个C语言的
main(a){printf(a,34,a="main(a){printf(a,34,a=%c%s%c,34);}",34);}
可以把自己打印出来
C++ 不知道有没有类似的
❽ 怎样打印程序源代码
网页的是: 查看=》源文件 会出现一个记事本文件,然后打印吧
❾ 求ASP操作excel数据库 功能实现查看,修改,统计,打印等等,源码或者模块,成分感谢!
摘 要 主要介绍用Excel做数据库并使用ASP编程对其进行操作
关键词 ASP,Excel,编程,数据库
一、 问题的提出
在ASP编程中会遇到很多大大小小的难题,我有一次为一家书店设计网站的时候就遇到了一个这样的难题。起初使用Access做数据库,该数据库主要是为了保存书店内图书的信息,但是当记录的条目过多时数据库的体积将会变得很大。在实际的应用中,网站的空间是有限的,很多要建设网站的客户都没有自己的主机,网站的空间是向网站空间提供商花钱购买而来的,这就要求在网站空间一定的条件下,尽量减小网站内文件的体积。于是我选择了Excel做数据库。
二、 方法与说明
将Excel文件(例如book.xls)看成一个数据库,其中的每一个工作表(sheet)看成数据库表。假设Excel中的第一行为字段名,所以你定义的范围中必须要包括第一行的内容。
Excel中的行标题(即字段名)不能够包含数字。Excel的驱动在遇到这种问题时就会出错(例如你的行标题名为“F1”)。如果你的Excel中某一列同时包含了文本和数字的话,那么Excel的ODBC驱动将不能够正常处理这一行的数据,你必须要保证该列的数据类型一致。
使用Excel做数据库在添加数据的时候可以在本地机上使用Microsoft Excel进行编辑。书商们在做图书数据的时候往往都是从各大出版社下载所需的图书信息,这些图书信息都有固定的格式,书商把下载的数据通过复制、粘贴等方法大批量的添加到Excel数据库中。做好数据后将Excel数据库上传到网站。这种方法有以下优点:快速、方便和易操作。
访问数据库信息的第一步是和数据库源建立连接。
使用Excel数据库的连接方法:
<%
Dim Conn,Driver,DBPath,Rs
Set Conn = Server.CreateObject("ADODB.Connection")
Driver = "Driver={Microsoft Excel Driver (*.xls)};"
DBPath = "DBQ=" & Server.MapPath("book.mdb")
Conn.Open Driver & DBPath
%>
其中Driver = "Driver={Microsoft Excel Driver (*.xls)};"
这一行代码是关键,主要是驱动的选择问题。我们同使用Access做数据库的连接方法比较下便知。
<%
Dim Conn,Driver,DBPath,Rs
Set Conn = Server.CreateObject("ADODB.Connection")
Driver = "Driver={Microsoft Access Driver (*.mdb)};"
DBPath = "DBQ=" & Server.MapPath("book.mdb")
Conn.Open Driver & DBPath
%>
三、 程序清单
查询并显示表Sheet1字段为书名的代码:
<%
Dim Conn,Driver,DBPath,Rs
' 建立Connection对象
Set Conn = Server.CreateObject("ADODB.Connection")
Driver = "Driver={Microsoft Excel Driver (*.xls)};"
DBPath = "DBQ=" & Server.MapPath("book.xls")
'调用Open 方法打开数据库
Conn.Open Driver & DBPath
'DSN连接方式
'Conn.Open "Dsn=book"
'注意 表名一定要以下边这种格试 "[表名$]" 书写
Sql="Select * From [Sheet1$]"
Set Rs=Conn.Execute(Sql)
IF Rs.Eof And Rs.Bof Then
Response.write "没有找到您需要的数据!!"
Else
Do While Not Rs.EOF
Response.write Rs("书名")
Response.write "<br>"
Rs.MoveNext
Loop
End IF
Rs.Close
Set Rs=nothing
Conn.Close
Set Conn=Nothing
%>
查询并显示表Sheet1全部内容的代码:
<%
Dim Conn,Driver,DBPath,Rs
Set Conn = Server.CreateObject("ADODB.Connection")
Driver = "Driver={Microsoft Excel Driver (*.xls)};"
DBPath = "DBQ=" & Server.MapPath( "book.xls" )
Conn.Open Driver & DBPath
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql="select * from [Sheet1$]"
Rs.Open Sql,conn,2,2
%>
<table border="1">
<tr>
<%
for i=0 to Rs.Fields.Count-1
%>
<td bgcolor="#0099FF"><%=Rs(i).Name%></td>
<%
next
%>
</tr>
<%
do while Not Rs.EOF
%>
<tr>
<%
for i=0 to Rs.Fields.Count-1
%>
<td><%=Rs(i)%></td>
<%
next
%>
</tr>
<%
Rs.MoveNext
Loop
Rs.close
set Rs=nothing
Conn.close
set Conn=nothing
%>
</table>
四、 结论
本文主要介绍ASP编程操作Excel,实现对Excel数据库的检索等功能。实现方法简单,程序代码少,可供实用编程时借鉴使用。以上程序在Windows2000Sever及IIS5.0下运行通过.
❿ 最近发现一个可能比较有趣的问题,如何编程使程序显示结果为其本身源码。程序执行结果就是打印出其源码。
/* A simple quine (self-printing program), in standard C. */
/* Note: in designing this quine, we have tried to make the code clear
* and readable, not concise and obscure as many quines are, so that
* the general principle can be made clear at the expense of length.
* In a nutshell: use the same data structure (called "progdata"
* below) to output the program code (which it represents) and its own
* textual representation. */
#include <stdio.h>
void quote(const char *s)
/* This function takes a character string s and prints the
* textual representation of s as it might appear formatted
* in C code. */
{
int i;
printf(" \"");
for (i=0; s[i]; ++i) {
/* Certain characters are quoted. */
if (s[i] == '\\')
printf("\\\\");
else if (s[i] == '"')
printf("\\\"");
else if (s[i] == '\n')
printf("\\n");
/* Others are just printed as such. */
else
printf("%c", s[i]);
/* Also insert occasional line breaks. */
if (i % 48 == 47)
printf("\"\n \"");
}
printf("\"");
}
/* What follows is a string representation of the program code,
* from beginning to end (formatted as per the quote() function
* above), except that the string _itself_ is coded as two
* consecutive '@' characters. */
const char progdata[] =
"/* A simple quine (self-printing program), in st"
"andard C. */\n\n/* Note: in designing this quine, "
"we have tried to make the code clear\n * and read"
"able, not concise and obscure as many quines are"
", so that\n * the general principle can be made c"
"lear at the expense of length.\n * In a nutshell:"
" use the same data structure (called \"progdata\"\n"
" * below) to output the program code (which it r"
"epresents) and its own\n * textual representation"
". */\n\n#include <stdio.h>\n\nvoid quote(const char "
"*s)\n /* This function takes a character stri"
"ng s and prints the\n * textual representati"
"on of s as it might appear formatted\n * in "
"C code. */\n{\n int i;\n\n printf(\" \\\"\");\n "
" for (i=0; s[i]; ++i) {\n /* Certain cha"
"racters are quoted. */\n if (s[i] == '\\\\')"
"\n printf(\"\\\\\\\\\");\n else if (s["
"i] == '\"')\n printf(\"\\\\\\\"\");\n e"
"lse if (s[i] == '\\n')\n printf(\"\\\\n\");"
"\n /* Others are just printed as such. */\n"
" else\n printf(\"%c\", s[i]);\n "
" /* Also insert occasional line breaks. */\n "
" if (i % 48 == 47)\n printf(\"\\\"\\"
"n \\\"\");\n }\n printf(\"\\\"\");\n}\n\n/* What fo"
"llows is a string representation of the program "
"code,\n * from beginning to end (formatted as per"
" the quote() function\n * above), except that the"
" string _itself_ is coded as two\n * consecutive "
"'@' characters. */\nconst char progdata[] =\n@@;\n\n"
"int main(void)\n /* The program itself... */\n"
"{\n int i;\n\n /* Print the program code, cha"
"racter by character. */\n for (i=0; progdata[i"
"]; ++i) {\n if (progdata[i] == '@' && prog"
"data[i+1] == '@')\n /* We encounter tw"
"o '@' signs, so we must print the quoted\n "
" * form of the program code. */\n {\n "
" quote(progdata); /* Quote all. */\n"
" i++; /* Skip second '"
"@'. */\n } else\n printf(\"%c\", p"
"rogdata[i]); /* Print character. */\n }\n r"
"eturn 0;\n}\n";
int main(void)
/* The program itself... */
{
int i;
/* Print the program code, character by character. */
for (i=0; progdata[i]; ++i) {
if (progdata[i] == '@' && progdata[i+1] == '@')
/* We encounter two '@' signs, so we must print the quoted
* form of the program code. */
{
quote(progdata); /* Quote all. */
i++; /* Skip second '@'. */
} else
printf("%c", progdata[i]); /* Print character. */
}
return 0;
}